Angular Interview Questions - Promise Vs Observable - With Practical Demo

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 พ.ค. 2023
  • 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
    TH-cam 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 ปีที่แล้ว +4

    good and simple explanation. Appreciations!!

  • @Abdulazizweb
    @Abdulazizweb 9 หลายเดือนก่อน +1

    crystal clear explanation bro. Amazing

  • @aparnamishra1530
    @aparnamishra1530 5 หลายเดือนก่อน +1

    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  5 หลายเดือนก่อน +1

      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 5 หลายเดือนก่อน +1

      thank u@@kyprogramming

  • @thiraani
    @thiraani ปีที่แล้ว +1

  • @101-cse-sreeharsha5
    @101-cse-sreeharsha5 9 หลายเดือนก่อน

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

    • @kyprogramming
      @kyprogramming  9 หลายเดือนก่อน

      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_memes 4 หลายเดือนก่อน +1

    nice but thoda zoom karo

  • @leemanheilee88
    @leemanheilee88 5 หลายเดือนก่อน +2

    The bell ring is so annoying

    • @kyprogramming
      @kyprogramming  5 หลายเดือนก่อน

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