Skip to content

Instantly share code, notes, and snippets.

@chrisRedwine
Created June 30, 2016 22:42
Show Gist options
  • Save chrisRedwine/b8269a2ac8f72d33920cb829969a0794 to your computer and use it in GitHub Desktop.
Save chrisRedwine/b8269a2ac8f72d33920cb829969a0794 to your computer and use it in GitHub Desktop.
Use AngularJS $q service to chain multiple promises together
var promise1 = {}; //something that returns a promise, like $http.get(...)
vra promise2 = {}; //something that returns a promise, like $http.get(...)
$q.all([promise1, promise2])
.then(function success(response) {
console.log(response.data);
}, function failure(response) {
alert('Error!');
console.log(response);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment