Created
January 20, 2014 15:26
-
-
Save 0xBADC0FFEE/8521915 to your computer and use it in GitHub Desktop.
From http://stackoverflow.com/questions/19037179/angular-synchronous-http-loop-to-update-progress-bar
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 promise = $q.all(null); | |
angular.forEach(urls, function(url){ | |
promise = promise.then(function(){ | |
return $http({ | |
method: 'GET', | |
url:url | |
}).then(function(res){ | |
$scope.responses.push(res.data); | |
}); | |
}); | |
}); | |
promise.then(function(){ | |
//This is run after all of your HTTP requests are done | |
$scope.doneLoading = true; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment