typescript - rxJS - what is come instead of 'Promise.done' -


in rxjs, when call http-get, accept observable type, instead of promise type of simple javascript.

now search after come instead of promise.done?

i saw people use observale.map, not need map - map multiple http callings.

what comes before?

simply subscribe request method (such get/post/etc). don't need use topromise(), , recommend against angular works nicely observables , more powerful promises.

// make http request: this.http.get('/api/items').subscribe(data => {   // handle result response.   this.results = data; }); 

https://angular.io/guide/http

don't worry unsubscribing these observables call .complete() method on observer , finish.

it's worth noting observables returned httpclient cold , no requests made until .subscribe() them.

i think might confusing map switchmap well, map transforming emitted items within stream, switchmap commonly used chaining observables nicely. http://reactivex.io/documentation/operators/map.html


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -