Introduction
In Angular 1, promises acted as strange birds. They were essential for building robust asynchronous applications, but using them seemed to come at a price. Their implementation by way of the $q
service and the duality of promise
and deferred
objects seemed bizarre. Nonetheless, once you were able to master them, it was easy to see how they could be the foundation of extremely robust implementations in the single-threaded event-driven world of JavaScript.
Fortunately, for developers everywhere, ES6 formally embraces the Promise feature as a central component. Since TypeScript is a superset of ES6, you will be pleased to know that you can wield promises everywhere in Angular without extra baggage. Although Observables subsume a lot of the utility offered by promises, there is still very much a place for them in your toolkit.
Tip
Being able to use Promises natively is a privilege of TypeScript to a JavaScript transpilation. As of now, some browsers support Promises natively, while...