Promise vs Observable | Difference between promise and observable in Angular (40 seconds )#Shorts

preview_player
Показать описание
Promise vs Observable: Both are use in Angular to perform some asynchronous operation. But there is difference between Promise and Observable

1) Promise are lazy while Observable are Eager , it means promise execute as soon as it is define but on other hand Observable need a subscribe() method to start execution

2) Promise can emit single value at a time but observable can emit multiple values over time

3)Promise is not cancellable while Observable can be cancel using unsubscribe() method

4) Promise don't support any operator but Observable support RxJS operator like map, forEach, retry and many more.

Follow us on:

For more such interesting videos, please subscribe to our channel and stay connected.

If you face any problem in today's topic then leave a comment below and let me know. I'll be happy to assist you.

#PromisevsObservable #NishaSingla #shorts
Рекомендации по теме
Комментарии
Автор

One there is already observables then why an angular developer has to know the concept of promise?

deepcode