Differentiate Observables and Promises?

974    Asked by AmitSinha in Python , Asked on Nov 12, 2019
Answered by Arun Singh

Angular uses the Observables from RxJS, instead of promises in order to deal with HTTP.

Promise is able to handle a single-event whenever an asynchronous operation fails or completes. It represents that task which is likely to be finished in future.

Observable allows you to pass 0 or more events whenever a call-back is called. Observable is like a function which takes an observer and then returns a function Observer. It also allows you to either subscribe or unsubscribe to data-stream, or emit the next value, notify about errors and then informs about stream completion to the observer.




Your Answer

Interviews

Parent Categories