angular2-authentication-sample
angular2-authentication-sample copied to clipboard
Avoided Route still load
( 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);
}
}