Currently delving into the world of RxJs, I would appreciate any verification or correction regarding my assumption.
Incorporating a public read-only observable in a service, which allows me to utilize .next()
at different points within my service class. Here is what I have implemented:
private myObservable = new Subject<T>();
public myObservable$: Observable<T> = this.myObservable.asObservable();
- Users can subscribe to
myObservable$
- I can use
myObservable.next(...);
While it functions perfectly fine, I acknowledge that there might be potential errors given my limited experience with RxJS. Is this the correct approach and suitable object for this particular scenario?