In this topic, We will see the most important topic in the angular world. i.e Observables & Promise. First, let us understand that what is observables? & then we will move toward the promises. Also, We will discuss the difference between observable vs promise.
What are Observables?
Simply observable means asynchronous/synchronous operation. If you request something then you don’t have to wait for its response you can simply demand multiple services at one time with no worry about the single response to come. It actually helps users to request multiple times and does not wait for the response to each request. So, Observable can emits multiple values.
What is Promise?
It’s exactly opposite to Observables. If you request something then you have to wait for its response to come. It’s always asynchronous to get operation. So, Promise emits a single value at a single time.
Difference between Observable vs Promise
|either asynchronous or synchronous||Always be asynchronous.|
|it’s not called untile we call subscribe() method||No subscribe() function required|
|It can be cancel using unsubscribe() method||Not easy to cancel|
If you want to learn more about angular & ionic development then visit here.