Closed
Description
I use angular loading bar and I want to show it when state change
This is the repo https://github.com/chieffancypants/angular-loading-bar
This part of code is in run method of main module app:
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
cfpLoadingBar.start();
});
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) {
cfpLoadingBar.complete();
});
I have this selector
cfpLoadingBarProvider.parentSelector = '.wrapper > section';
The problem is that the selector is in nested view and the $stateChangeStart starts before view is loaded so I got error from loading bar because it not found the selector.
This is the error
TypeError: Cannot read property 'lastChild' of undefined
at Object._start [as start] (loading-bar.js:215)
at app.js:253
at Scope.parent.$get.Scope.$broadcast (angular.js:16238)
at Object.transitionTo (angular-ui-router.js:3140)
at Array.<anonymous> (angular-ui-router.js:2318)
at Object.invoke (angular.js:4473)
at handleIfMatch (angular-ui-router.js:1822)
at angular-ui-router.js:1877
at check (angular-ui-router.js:1992)
at update (angular-ui-router.js:2001)
Any solution??
Thanks
FS
Metadata
Metadata
Assignees
Labels
No labels