Created
June 30, 2016 22:42
-
-
Save chrisRedwine/b8269a2ac8f72d33920cb829969a0794 to your computer and use it in GitHub Desktop.
Use AngularJS $q service to chain multiple promises together
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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