Reputation: 3327
I am using app.run()
to fire a method that initializes a user session.
Now I was just adding another method to app.run()
and discovered that some method in the routeProviders resolve
fired asynchronously, overlapping with the session initialisation and therefore crashing the application.
How can I ensure that app.run()
has executed before firing anything route related?
Upvotes: 1
Views: 60
Reputation: 580
Are you trying to do somthin async in your app.run() ?? this may help
angular.element(document).ready(
function() {
var initInjector = angular.injector(['ng']);
var $http = initInjector.get('$http');
$http.get('/test.json').then(
function (response) {
var x = response.data;
angular.bootstrap(document, ['App']);
}
);
}
);
Upvotes: 1