Last active
April 19, 2016 17:29
-
-
Save ry8806/0cf5b41adfa8a87f83af1bc5a08e49eb to your computer and use it in GitHub Desktop.
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 = getFirstValue().then(function (value) { | |
return value; | |
}); | |
// We can just return a value without creating a promise if we don't need. | |
var promise2 = "A value that is instant"; | |
var promise3 = getThirdValue().then(function (value) { | |
return value; | |
}); | |
var promise4 = getFourthValue().then(function (value) { | |
return value; | |
}); | |
var theResults = []; | |
$q.all([promise1, promise2, promise3, promise4]).then(function(result){ | |
for (var i = 0; i < result.length; i++){ | |
theResults.push(result[i]); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment