I am creating a service that provides an Observable. In this service, I receive external function calls that should call the next Observable call so that different users receive a subscription event. In the Observer constructor, I can call further, and everything works fine, but how can I access this outside the constructor so that external triggers can trigger the following calls?
private myObservable$: Observable<any>;
During service initialization
this.myObservable$ = new Observable(observer => { observer.next("initial message"); }
Then, in other methods of the same service, I want to be able to execute something like
this.myObservable$.observer.next("next message");
Above obviously does not work, but how can I achieve this?
I assume that I am missing something basic, as there should be a way to generate additional messages outside the original Observable constructor
angular rxjs
Joshua ohana
source share