I study RxJs, I am looking for confirmation or correction according to my assumption.
I am trying to make public reading only observable in a service that I can use .next()in different places of my service class. I am wondering if this is the right thing to do:
private myObservable = new Subject<T>();
public myObservable$: Observable<T> = this.myObservable.asObservable();
- User can subscribe to
myObservable$ - I can use
myObservable.next(...);
It works fine, but I have enough experience to know that I can be just an involuntary idiot (RxJS is huge). Is this the correct template and the correct object for the specified use case?
source
share