Last active
August 29, 2015 14:24
-
-
Save F1LT3R/b8ebd5cb39a75d286127 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.controller('MyController', ['$rootScope', function($rootScope) { | |
| $rootScope.$on('$stateChangeStart', function (event, toState) { | |
| usSpinnerService.spin('spinner-1'); | |
| }); | |
| $rootScope.$on('$stateChangeSuccess', function (event, toState) { | |
| usSpinnerService.stop('spinner-1'); | |
| }); | |
| $rootScope.$on('$stateChangeError', function (event, toState) { | |
| usSpinnerService.stop('spinner-1'); | |
| }); | |
| }]); |
Author
What happens when you console.log in the stateChangeStart event?
$rootScope.$on('$stateChangeStart', function (event, toState) {
console.log('STATE CHANGE START');
console.log(event);
});nothing is printed
can you post me the full implementation?
it worked with below code
$rootScope.closeAlert = function(index) {
$rootScope.alerts.splice(index, 1);
};
$rootScope.$on('$routeChangeStart', function () {
usSpinnerService.spin('pageLoaderSpinner');
});
$rootScope.$on('$routeChangeSuccess', function (event, next, current) {
usSpinnerService.stop('pageLoaderSpinner');
});
$rootScope.$on('$routeChangeError', function (event, next, current) {
usSpinnerService.stop('pageLoaderSpinner');
});
thanks for your help.
Author
No problem, glad you found something that worked for you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi F1LT3R,
It is not working and not giving any error also. Do i need to add anything in the html page apart from this codes?