Ankush
Ankush

Reputation: 685

Unsubscribe observable's promise

How do I unsubscribe an observable if it's converted to promise? I'm using RxJS in Angular 2

import 'rxjs/add/operator/toPromise';

return this.http.get(this.heroesUrl)
                  .toPromise()
                  .then(this.extractData)

Upvotes: 6

Views: 7935

Answers (1)

micronyks
micronyks

Reputation: 55443

If you subscribe to an Observable then it is possible to unsubscribe to it.

When you return promise(here it seems you return promise -not observable), you usually don't subscribe to it. right??
So you can't unsubscribe to it(promise).

Upvotes: 16

Related Questions