What are the differences between observables & promises?



What are the differences between observables & promises?..

Answer / Arman Awasthi

Observables and Promises are both used for handling asynchronous operations in JavaScript, but they differ in a few key ways:
1. Observables are reactive, allowing you to react to multiple events (like repeated data emissions or errors) over time, while Promises are synchronous, representing a single value that will be resolved at some point in the future.
2. Observables can be chained with operators like map(), filter(), and reduce() to perform complex operations on streams of data. Promises do not have similar built-in support for chaining.
3. Observables use a subscription model, where you subscribe to an observable to start receiving its emissions. Promises use a then() method for handling the resolved value or caught errors.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

What do you know about internationalization?

1 Answers  


What is interceptor in angular?

1 Answers  


How would you use a route guard?

1 Answers  


What is ng-model in angularjs?

1 Answers  


What are the symbols used in one way and two ways data binding?

1 Answers  


Why use node.js?

1 Answers  


Is wordpress a framework?

1 Answers  


What's new features in angular 5?

1 Answers  


Which of the following directive is used to initialize an angular app?

1 Answers  


What is difference between http and httpclient in angular?

1 Answers  


Explain ng-show directive angularjs?

1 Answers  


Explain The Directives Ng-If, Ng-Switch, And Ng-Repeat?

1 Answers  


Categories