Skip to content

Inject resolved value into onExit function. #3081

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

Closed
Dav1dde opened this issue Oct 11, 2016 · 1 comment
Closed

Inject resolved value into onExit function. #3081

Dav1dde opened this issue Oct 11, 2016 · 1 comment
Milestone

Comments

@Dav1dde
Copy link

Dav1dde commented Oct 11, 2016

I have a state like this:

.state('design', {
    url: '/design',
    templateUrl: 'design.html',
    resolve: {
        cc: ['$stateParams', 'configuratorService', function ($stateParams, configuratorService) {
            return configuratorService.update($stateParams, true);
        }]
    },
    onExit: ['cc', '$state', function (cc, $state) {
        console.log(cc);
    }]
}

When I leave the state, I always get this exception: Error: [$injector:unpr] Unknown provider: ccProvider <- cc. This used to work with angular-ui-router v0.2.18.

I also tried basically any combination of $state.transition.injector().get('cc') and $transition$.injector().get('cc') it seems to only be able to get the variables of the next state.

In short: Is there a way to get the values resolved when entering the state in the corresponding onExit function?

Angular 1.5.5, [email protected]

@christopherthielen
Copy link
Contributor

I believe that's intended to still work in 1.0. I'll take a look

@christopherthielen christopherthielen added this to the 1.0.0-final milestone Oct 12, 2016
christopherthielen added a commit that referenced this issue Nov 2, 2016
fix(onExit): inject the current transition as `$transition$`

Closes #3081
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants