$q
Promise In Angularjs- $q Service. Promises in AngularJS is provided by $q service. It has reach feature like any other Promise library. $q service is a service that helps you to run your code asynchronously.
Javascript Promises
The promise constructor takes one argument, a callback with two parameters, resolve and reject. Do something within the callback, perhaps async, then call resolve if everything worked, otherwise call reject.