Skip to content

Instantly share code, notes, and snippets.

@ry8806
Last active April 15, 2016 21:45
Show Gist options
  • Select an option

  • Save ry8806/74ae4935726c0ddc465b1d1548bd9aab to your computer and use it in GitHub Desktop.

Select an option

Save ry8806/74ae4935726c0ddc465b1d1548bd9aab to your computer and use it in GitHub Desktop.
AngularJS combining promises
var theResults = [];
someAsyncWork().then(function(result){
return getFirstValue().then(function (value) {
theResults.push(value);
});
}).then(function (result) {
return getSecondValue().then(function (value) {
theResults.push(value);
});
}).then(function (result) {
return getThirdValue().then(function (value) {
theResults.push(value);
});
}).then(function (result) {
return getFourthValue().then(function (value) {
theResults.push(value);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment