Observables
In AngularJS, we consumed services to retrieve data asynchronously using promises in $http
. In Angular, we have the Http
service over $http
, and it returns an observable object instead of a promise as it applies a pattern called the analogous pattern. Angular leverages the Observable class adopted from the ReactiveX library. ReactiveX is an API for asynchronous programming with Observables that is done by applying the observer and iterator patterns and functional programming. You can find more information about Reactive programming at http://reactivex.io/.
Observer pattern will notify the dependents if their dependency object is changed. Iterator pattern will facilitate access to a collection without the need to know about the structure of the element in the collection. Combining these patterns in ReactiveX enables the observer to subscribe to an observable collection objection. The observer doesn't need to wait until the observable collection object is available. Instead, the...