Angular 2 - Handling multiple subscriptions on a single observable Angular 2 - Handling multiple subscriptions on a single observable angular angular

Angular 2 - Handling multiple subscriptions on a single observable


This is probably due to the fact that your Observable<Response> is a cold observable, i.e. it is 'restarted' for every new subscriber. For an explanation of hot vs. cold observables, have a look at Hot and Cold observables : are there 'hot' and 'cold' operators?. So here you probably subscribe once for the result handler, and another time for the error handler.

You should be able to workaround the subscriptions side effect by 'sharing' your observable,

i.e. replace

var response = super.get(url, options);

With

var response = super.get(url, options).share();`