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

Avoided Route still load #43

Open
jackesdavid opened this issue Jan 11, 2016 · 0 comments
Open

Avoided Route still load #43

jackesdavid opened this issue Jan 11, 2016 · 0 comments

Comments

@jackesdavid
Copy link

( sorry about my english)

i think the code need a little change.
If you want to avoid a route you need to skip activation, so my propose is
We dont need to do load a route if will be avoided, so do not activate yet

    activate(instruction:ComponentInstruction)
    {
        var url = this.parentRouter.lastNavigationAttempt;
        //check in your way if the route is valid...
       // is not valid
        if (instruction.urlPath != 'About')
        {
            this.parentRouter.navigate(['/About']);
        }
        //is Valid
        else
        {
            return super.activate(instruction);
        }
    }
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