Last active
December 14, 2015 17:28
-
-
Save zivester/5122216 to your computer and use it in GitHub Desktop.
angular.js: $q parallel set
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 fields = {}; | |
| var p1 = $http.get('/api/field/sizes').success(function(sizes){ | |
| fields.sizes = sizes; | |
| }); | |
| var p2 = $http.get('/api/field/colors').success(function(colors){ | |
| fields.colors = colors; | |
| }); | |
| $q.all(p1, p2).then(function(){ | |
| // How do I have 'fields' populated here? | |
| console.log(JSON.stringify(fields)); // returns '{}' | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment