Handles a single event when an async operation completes or fails,
Doesn't support cancellation,
Promise will eventually call the success or failed callback even when you don't need the notification or the result it produces,
Promise starts immediately,
Does not provide any operators.
Example #1:
Example #2:
Observable
Similar to a stream, an observable permits the passing of zero or more events, with the callback being triggered by each event,
Observable allows you to handle 0 events, 1 events, or numerous events,
The subscription of an Observable allows you to cancel the subscription if the result of an HTTP request to a server or some other expensive async operation is no longer required,
Observable doesn't begin until you subscribe to it, Observables are said to as lazy,
Similar to an array, Observable offers operators like map, forEach, reduce, etc.,
Before the observable is processed via subscribing, a chain of operators may be built up using lazy execution, allowing for more declarative programming,
{{ 'Comments (%count%)' | trans {count:count} }}
{{ 'Comments are closed.' | trans }}