Last active
April 15, 2016 21:45
-
-
Save ry8806/74ae4935726c0ddc465b1d1548bd9aab to your computer and use it in GitHub Desktop.
AngularJS combining promises
This file contains hidden or 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 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