Angular promises vs observables

preview_player
Показать описание
Text version of the video

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.

Slides

Angular 2 Tutorial playlist

Angular 2 Text articles and slides

All Dot Net and SQL Server Tutorials in English

All Dot Net and SQL Server Tutorials in Arabic

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
Рекомендации по теме
Комментарии
Автор

Really salute your efforts. Even in the mid night you work and upload videos for us !!!

studentfeedback
Автор

Thank you Venkat for making these. You're the man!

hoangson
Автор

Thanks you so much venkat for these awesome easy to follow tutorials . Your examples deal with practical real world problems. I am able to shorten the learning curve for angular with ur help.

rahulmathew
Автор

OMG !!! Great explanation, huge contribution to the society.

Gamerthatpokemon
Автор

Hi venkat, I have a question for You, I was developed on mobile app by using angular and ionic, it is chatting application, so same app is in webside but it is javascript and html, jquery etc. I want to use emoji's should support for mobile and web, so please guide me am unable to do

harikagunti
Автор

Hey, you're fantastic! Super clear and efficient videos, easy to follow and understand tough topics. You make coding that much more fun. Kudos!

hyperfluous
Автор

At 3:00 line 60 what is that syntax called and do you know where I can find documentation on it?

sameerdewan
Автор

What exactly mean by observable emits multiple values?
Can you please explain?

lakshminaidu
Автор

Hii kudvenkat,

Nice explanation. But having one doubt i.e. difference between Emitting a single value (In case of promise) and Emitting multiple values (In case of Observable).
Can you please it explain in detail.

shikhashakarwar
Автор

Thank you so much for your efforts and a very clear understanding of the concept.

amity
Автор

Hi kudvenkat,

Can u do some video/tutorial about signalR technology?

ahmeticat
Автор

Dear sir can you make a series on design pattern in c# after you are done with this series? You have a gift to break down things in way that is easily understood

gladiumcaeli
Автор

Awesome video. Very clear, thank you!

jamesbest
Автор

Hi Kudvenkat
Now a days Interviewers are confusing us about promises and Observables,
Can you please very strong use case when only use promise Vs when only use Observable

venkatajayaprakashnagabirv
Автор

Can you please explain the first diffrence with an example. So we will know the actual working of promise and observable.
How promise emits single value and observable emits multiple values?
It will really helpful for us, thanks in advance.

amity
Автор

I still have the problem where I click on one of the links for emp and I always get emp101 back. The problem with your videos is that they build on earlier tutorials and don't include the complete code. So, since I received an error from an earlier tutorial and can't fix the error, the error just gets carried over to the newer tutorials. I see in developer tools that when I click on say emp103, with a break point on "this.employee = employeeData;", I get "ReferenceError: empCode is not defined".

josephregallis
Автор

it means if want to get single data we should use promises and for multiple data we should go for observable, right?

SavitaWadje-sv
Автор

Thanks sir, this is to good. i am waiting for your next video how to check authentication and authorisation in angular login.

gauravlambha
Автор

thank you sir, It clears all my doubt <3

atifworld
Автор

Great Tutorial.
I have the following question
what changes will be required in on web API get method to send the multiple responses as a stream for the single request so that it can be handled in observable

Example
Get the progress (0 to 100) from web API to angular service.

santoshugale