AngularJS Corner – Using promises and $q to handle asynchronous calls
A number of Angular services return promises: $http
, $interval
, $timeout
, for example. Anything needing to run in the background will need to coordinate with a caller such as a controller or directive, and the promise API is the way to go. But how does it work? We’ll show you how with this short tutorial.