This is a two part question:
I am using the resolve property inside $stateProvider.state() to grab certain server data before loading the controller. How wo
I developed the following solution which works perfectly for me.
1. Add the following app.run
app.run(function($rootScope){
$rootScope
.$on('$stateChangeStart',
function(event, toState, toParams, fromState, fromParams){
$("#ui-view").html("");
$(".page-loading").removeClass("hidden");
});
$rootScope
.$on('$stateChangeSuccess',
function(event, toState, toParams, fromState, fromParams){
$(".page-loading").addClass("hidden");
});
});
2. Place the loading indicator just above the ui-view. Add id="ui-view" to ui-view div.
Loading...
3. add the following to your css
.hidden {
display: none !important;
visibility: hidden !important;
}
NOTE:
A. The above code will display loading indicator in two cases 1) when the angular app is loaded first time 2) when the view is changed.
B. If you don't want the indicator to be shown when the angular app loads first time (before any view is loaded), then add hidden class to the loading div like below