Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading bar don't find parentSelector #239

Closed
furyscript opened this issue Sep 23, 2015 · 2 comments · Fixed by #244
Closed

Loading bar don't find parentSelector #239

furyscript opened this issue Sep 23, 2015 · 2 comments · Fixed by #244
Milestone

Comments

@furyscript
Copy link

I use angular ui router and I want to show angular loading bar when state change

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

@furyscript
Copy link
Author

Some solution?

@jklaus
Copy link
Contributor

jklaus commented Feb 8, 2016

I have resolved the issue caused by the parentSelector implementation in pull 272. Feel free to pull from me.

@chieffancypants chieffancypants added this to the next version milestone Feb 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants