Promises vs Observables - What Is the Difference?

preview_player
Показать описание
Most people starting to work with Angular don't understand the difference between promises and observables. They try to convert everything to promise because this is something familiar to them. Observables is a core component of Angular and you must understand why it is so beneficial.

MOST POPULAR COURSES

FOLLOW ME
Рекомендации по теме
Комментарии
Автор

Thank you so much. Really helpful for my next interview.

karthickr
Автор

If we return a promise obect from a service function and then if we call that function in component and in component if we call then() wouldn't it act as lazy call. With observable also we do same thing, like we call api in service function and then in component we call subscribe(). So isn't promise and observable both lazy call mechanism?
Please let me know if my understanding is wrong.

sachinmandal
Автор

- value: observables emit value over time but promiss emit value once
- called: promiss is not lazy, being called righ after creating then promiss lazy, just execute when subcribe to that

nguyentientai