Skip to content

how capture route error $stateChangeError ? #3531

@GlauberF

Description

@GlauberF

I'm trying to capture the error, but they're not getting it.

code in my route:
resolve: { login: function($q, $auth) { if ($auth.isAuthenticated()) { return true; } else { var errorObject = { code: 'NOT_AUTHENTICATED' }; return $q.reject(errorObject); } } }

code no .run:
`$rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error) {
event.preventDefault()

$timeout(function() {
    $state.go('app.auth_entrar');
    console.log(event, toState, toParams, fromState, fromParams, error);
});

})`

answer on error:
erro

where I should receive the error that I created, I get an error from angularjs, where am I wrong ??

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions