I have watch a few courses on Angular and have found there are different ways to manage data from an Http request.
.map()
, .subscribe()
.toPromise()
, .then()
, .catch()
I have used toPromise()
in my application as I find it similar to the AngularJS Http services.
In what scenario would I need to use Observables?
If you like the reactive programming style and want to be consistent within your application to always use observables even for single events (instead of streams of events) then use observables. If that doesn't matter to you, then use toPromise()
.
One advantage of observables is, that you can cancel the request.
See also Angular - Promise vs Observable