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:

BY Best Interview Question ON 19 Jun 2020

Example

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