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

onBefore hook returning Promise<TargetState> does not work. #3334

Closed
grant77 opened this issue Feb 11, 2017 · 1 comment
Closed

onBefore hook returning Promise<TargetState> does not work. #3334

grant77 opened this issue Feb 11, 2017 · 1 comment

Comments

@grant77
Copy link

grant77 commented Feb 11, 2017

If I return just TargetState it works. But if the I return the TargetState from within a promise it does not. My hook looks like this

    function hook(transition) {
        var target = transition.router.stateService.target,
            targetState = transition.targetState(),
            targetStateInternal = targetState.state(),
            targetStateData = targetStateInternal && targetStateInternal.data,
            allowAnonymous = targetStateData && targetStateData.allowAnonymous;

        // Returning right here outside of promise will work.  Ie:
        // return target(loginStateName, { redirectTo: targetState.name(), redirectParams: targetState.params() });

        return !allowAnonymous ? signInManager.isSignedIn().then(noop, error) : null;

        function error() {
            return target(loginStateName, {
                redirectTo: targetState.name(),
                redirectParams: targetState.params()
            });
        }
    }
@grant77
Copy link
Author

grant77 commented Feb 11, 2017

Nevermind. I did something to address this bug #2676 and it caused this bug.

@grant77 grant77 closed this as completed Feb 11, 2017
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

No branches or pull requests

1 participant