client/shared/directives/viewLoadingDirective.js
/*
    Directive, that shows loading on route change
*/
Directive, that shows loading on route change
Directive that shows loading on route change
function viewLoading($rootScope, loadingService) {
    return {
        restrict:'E',
        template:'<h2 class="text-center loading" ng-if="root.loading.isViewLoading">Loading...</h2>',
        link:function(scope, elem, attrs){
            $rootScope.$on('$routeChangeStart', function(){
                loadingService.isViewLoading = true;
            });
            $rootScope.$on('$routeChangeSuccess', function(){
                loadingService.isViewLoading = false;
            });
        }
    };
}
function viewLoading ( $rootScope , loadingService ) { return { restrict : 'E' , template : '<h2 class="text-center loading" ng-if="root.loading.isViewLoading">Loading...</h2>' , link : function ( scope , elem , attrs ) { $rootScope . $on ( '$routeChangeStart' , function ( ) { loadingService . isViewLoading = true ; } ) ; $rootScope . $on ( '$routeChangeSuccess' , function ( ) { loadingService . isViewLoading = false ; } ) ; } } ; }
Directive, that shows loading on route change
Directive that shows loading on route change
// when route start to load // when route successfully loaded