Skip to content

Unable to access event.currentScope in $stateChangeSuccess #1005

Closed
@ncuillery

Description

@ncuillery

I searched a way to get the scope associated to the current state. I used the $stateChangeSuccess event who expose the event.currentScope... but I found a strange behavior when logging the event.currentScope :

$scope.$on('$stateChangeSuccess', function(event) {
    console.log('event ', event);
    console.log('event.currentScope', event.currentScope);
});

The first console.log displays the whole event object, and I can see what I need under the property currentScope.
But if I try to log specifically event.currentScope, I get an another scope (the $rootScope, I think).

With console.log or anything else, I can't get the currentScope.

See it in action here : http://jsfiddle.net/Cuicui74/HxrSd/11/ (open console).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions