questions - Question:Hold a service's initialization until all promises are resolved

In routeProvider we can hold the routing if we give a resolve object which contains promises; it would wait until all the promises are resolved. However, I couldn't find a way do it in initialization of the application.

There is angular.module("app", []).run(function (){ //init app }) but for a $resource or $http which is async, the app can finish initialization before the dependencies (promises) are resolved that would create a race condition. We don't want that.

So the question is, is there a way which would hold the initialization of a service until all the given promises are resolved?


asked Sep 13, 2013 in rauter by rajesh
edited Sep 12, 2013
0 votes

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.