Promises are a tactic for deferred computing, suitable for several styles of concurrency: thread and event loop concurrency for local computation, and both synchronous and asynchronous remote messaging. A promise represents the eventual result of an asynchronous operation. The primary way of working with promises is through a method which registers callbacks to receive the promise's eventual value or the reason why the promise cannot be fulfilled.

- Stackoverflow.com Wiki
5 articles, 0 books.

Promises capture the notion of an eventual value into an object.


The idea is simple enough – you want to create a service that captures the data and stores is and then notify the controller that the data has changed or refreshed. Let’s look at a few different approaches to help us understand how the $http service works with its custom promises.


This blog post gives tips for error handling in asynchronous, Promise-based functions.


A JavaScript Promise represents the result of an operation that hasn't been completed yet, but will at some undetermined point in the future. An example of such an operation is a network request. When we fetch data from some source, for example an API, there is no way for us to absolutely determine when the response will be received.


When you are writing JavaScript, callbacks are one of the most confusing concepts. Promises are the new approach to improve working with async code.