Angular promises vs observables

kudvenkat
kudvenkat
194.4 هزار بار بازدید - 7 سال پیش - Text version of the video
Text version of the video
http://csharp-video-tutorials.blogspo...

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
@aarvikitchen5572

Slides
http://csharp-video-tutorials.blogspo...

Angular 2 Tutorial playlist
Angular 2 tutorial for beginners

Angular 2 Text articles and slides
http://csharp-video-tutorials.blogspo...

All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenka...

All Dot Net and SQL Server Tutorials in Arabic
kudvenkatarabic

In this video we will discuss the differences between promises and observables. In Angular 2, to work with asynchronous data we can use either Promises or Observables. In our previous videos in this series, we discussed using both Observables and Promises. There are several differences between Promises and Observables. In this video let's discuss these differences.

A Promise emits a single value where as an Observable emits multiple values over a period of time. You can think of an Observable like a stream which emits multiple items over a period of time and the same callback function is called for each item emitted. So with an Observable we can use the same API to handle asynchronous data whether that data is emitted as a single value or multiple values over a period of time.

A Promise is not lazy where as an Observable is Lazy.

A Promise cannot be cancelled where as an Observable can be cancelled using the unsubscribe() method

Observable provides operators like map, forEach, filter, reduce, retry, retryWhen etc
7 سال پیش در تاریخ 1396/06/14 منتشر شده است.
194,488 بـار بازدید شده
... بیشتر