Thanks to this answer AngularJS app.run() documentation? i can see the order in which modules are ran by Angular, my question is:
if I have:
app.config(function () {
$routeProvider.when('/', {
....
resolve: {
// something to resolve
}
});
});
app.run(function () {
// something to run
});
Will run()
be executed before the routeProvider resolve:{}
is resolved?
At least in my experiments, yes the resolve is run after app.run
.
In this jsfiddle you can see the calling order I got was:
As you can see in the fiddle, I checked this by using a console.log
function as the value of a property of the object handed to resolve
:
resolve: {
data: function() {
console.log('Data resolve called');
}
}
You can use this same approach in your code to check when routeProvider
begins checking the dependencies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With