Promises are provided by the in-built $qservice in AngularJS. It is used to provide a way to execute multiple asynchronous functions in series by basically registering them with an object of promise. Promises are used widely in Angular, Javascript and the ES6 specifications equally.

Here’s an example of a promise object in Angular:

Example

                                        

.run(function(getData) {
  var promise = getData()
    .then(function(string) {
      console.log(string)
    })
})

Suggest An Answer

Our Particitants

A promise represents the eventual result of an operation. You can use a promise to specify what to do when an operation eventually succeeds or fails.