When it would be useful to change the Observed to a promise

I work with Angular 2, and I was wondering if anyone could explain a situation where it would be useful to convert and watch the promise?

Ex. Rx.Observable.toPromise()

I know the differences between promises and observables. Again, I was just curious what kind of situation the operator might come in handy toPromise().

Thank:)

+4
source share
2 answers

The obvious situation is when you impose an API that the API only interacts with promises, you get some of the inputs for this API as observables. If all these conditions are met, then you must convert your observable into a promise.

, , ? , . API, API ..

, .toPromise , .

+2

A promises . , , ( ).

API , - then catch, then , , .

, .

0

All Articles