Angular Interview Questions - Promise Vs Observable - With Practical Demo

Ғылым және технология

In the series of Angular Interview question , In this video we will cover , what is the differences we have between Promise and Observable.
Promise is part of JavaScript and Observable is part of Rxjs Library.
Promise and Observable , both are used to achieve asynchronous functionality in Angular.
Differences:
-----------------------------------------------------------------------------------------------------------------------
****************
Promise -
****************
1. Part of JavaScript
2. Callback (resolve , reject)
3. Eager Loading
4. Return single value using then()
5. Non cancelable
6. Always async
7. Do not provide operators
****************
Observable -
****************
1. Part of Rxjs (Reactive extension of JavaScript)
2. Callback (success , error , complete)
3. Lazy Loading
4. Return multiple value using subscribe()
5. Cancelable/unsubscribe
6. Behave async and sync both
7. Offer operations like map, filter, reduce, retry replay, forEach, and many more
Used Command:
------------------------------------------------------------------------------------------------------------------
Used Command:
-----------------------------------------------------------------------------------------------------------------------
ng serve -o
Follow Me:
-----------------------------------------------------------------------------------------------------------------------
FACEBOOK - / kyprogramming
TWITTER - / kyprogramming
KZread Channel -
-----------------------------------------------------------------------------------------------------------------------
/ @kyprogramming
If you have not subscribed yet then please SUBSCRIBE and do not forgot to press the bell icon in order to get notification for all my upcoming videos as well as please like and share to the others as well.
Interview Questions -
-----------------------------------------------------------------------------------------------------------------------
1. What is the difference between Promise and Observable?
2. What are the callback functions we have in Promise and Observable?
3. Is Promise eager loading and how?
4. Is Observable lazy loading how?
5. How to create and execute Promise and Observable?
6. How to unsubscribe Observable?
7. Is Promise asynchronous or synchronous?
8. How Observable perform synchronous and asynchronous both?
9. How to use the operators in Observable?

Пікірлер: 14

  • @t.sandeepreddy5004
    @t.sandeepreddy5004 Жыл бұрын

    good and simple explanation. Appreciations!!

  • @kyprogramming

    @kyprogramming

    11 ай бұрын

    Glad you liked it

  • @Abdulazizweb
    @Abdulazizweb8 ай бұрын

    crystal clear explanation bro. Amazing

  • @kyprogramming

    @kyprogramming

    8 ай бұрын

    Thank you!

  • @thiraani
    @thiraani11 ай бұрын

  • @aparnamishra1530
    @aparnamishra15304 ай бұрын

    very informative video, i have a question, what if i use toPromise() with observables instead of promise? You can make a separate video on it. also explain await, async in the same video so that we'll get clear idea.

  • @kyprogramming

    @kyprogramming

    4 ай бұрын

    Thank you Aparna! .toPromise is utility method from Observable and that is used to convert an Observable into a Promise which resolve promise with the last emited value. Hope I have answered for your query. Certainly I will make an video on async and await soon. Thank you for your suggestion. Thanks

  • @aparnamishra1530

    @aparnamishra1530

    4 ай бұрын

    thank u@@kyprogramming

  • @101-cse-sreeharsha5
    @101-cse-sreeharsha58 ай бұрын

    Promises return single value using .then() method, but you have written .next() method.

  • @kyprogramming

    @kyprogramming

    8 ай бұрын

    Thanks you. Promise use then() and Observable use subscribe() with callback next() function to fetch data. There was a typing error, I will try to update that. However I have explained promise in the code by using then() method.

  • @viral_topics_memes
    @viral_topics_memes3 ай бұрын

    nice but thoda zoom karo

  • @kyprogramming

    @kyprogramming

    3 ай бұрын

    Thank you!!

  • @leemanheilee88
    @leemanheilee883 ай бұрын

    The bell ring is so annoying

  • @kyprogramming

    @kyprogramming

    3 ай бұрын

    Thank you for letting me know.. I will take care of bell ring from all my upcoming video.

Келесі