Explain the difference between promise and observable in angular?



Explain the difference between promise and observable in angular?..

Answer / Vishesh Bahadur Srivastav

In Angular, a Promise is a JavaScript object that represents the eventual completion or failure of an asynchronous operation. It has a `then` method for handling the resolved value and a `catch` method for handling errors. An Observable, on the other hand, is a stream of data that can be asynchronously emitted over time. Observables have various operators (such as `map`, `filter`, and `concat`) to manipulate the stream of data and a subscription mechanism to listen for changes.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

What is $location in angularjs?

1 Answers  


Explain ng-controller directive angularjs?

1 Answers  


What are angularjs modules?

1 Answers  


What is $emit, $broadcast and $on in AngularJS?

1 Answers  


How would you select a custom component to style it?

1 Answers  


What are the new features in angular 8?

1 Answers  


What is the factory method in angularjs?

1 Answers  


What are the concept of scope hierarchy? Tell me how many scope can an application have?

1 Answers  


What is eventemitter angular2?

1 Answers  


What is class binding in angular?

1 Answers  


What is patchvalue used for?

1 Answers  


How can you create a decorator in angular?

1 Answers  


Categories