I have a reference to an observable, and I'm trying to trigger it to emit again after the first time it emits (or completes?). Is it possible to make this reference I've stored emit one more time?
this._dashboardsObservable = this._http.get(PGDashService.MODEL_URL)
.map((response: Response) => {
this._model = this.parse(response.json());
return this._model;
})
.catch((error: any) => Observable.throw(error || 'Server error'));
To be specific, no, a consumer of an observable can't force the observable to re-emit. The observable is responsible for producing its own values, and the observer merely gets values pushed to it from the observable.
However, i am sure there are other ways to arrive at what you're trying to do. For example, the use of a BehaviorSubject can allow you to cache the last value emitted so the next observer to subscribe will automatically get the last value sent to it.
You'll have to be more specific about what you're actually trying to accomplish to be guided any futher.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With