Gajendra Jangid
What is main difference between observable and promise?
By Gajendra Jangid in Angular on Mar 09 2022
  • Muhammad Imran Ansari
    Mar, 2022 17

    Both observables and promises help us work with asynchronous functionality. The core difference is promises deal with one asynchronous event at a time, while observables handle a sequence of asynchronous events over a period of time.

    Observables:
    Emit multiple values over a period of time.
    Not executed until we subscribe them.
    Cancellable, which stops the listener from receiving further values.
    Hand over errors to the subscribers.

    Promises:
    Emit a single value at a time.
    Execute immediately after creation.
    Not-Cancellable.
    Push errors to their child promises.

    • 1


Most Popular Job Functions


MOST LIKED QUESTIONS