Please,
I'm using ui-router on my project. $stateChangeStart
event work fine when the user navigate between the states.
But it doesn't work if I refresh the browser.
This is my source code:
(function(){
'use strict';
angular.module('app.overlay')
.directive('ibLoading', ['$rootScope' , '$timeout', loading]);
function loading($rootScope , $timeout){
console.log("In dirrective");
var directive = {
restrict:'EAC',
link:link
};
function link(scope, element) {
$rootScope.$on('$stateChangeStart', function() {
$timeout(function(){
element.addClass('show');
} , 50);
});
$rootScope.$on('$stateChangeSuccess', function() {
$timeout(function(){
element.removeClass('show');
} , 700);
});
}
return directive;
}
})();
my layout file
<div ng-controller="ShellController as vm">
<header class="clearfix">
<ht-top-nav navline="vm.navline"></ht-top-nav>
</header>
<section id="content" class="content">
<!--<div ng-include="'app/layout/sidebar.html'"></div>-->
<div ui-view></div>
<div class="ib-loading">Loading ...</div>
</section>
</div>