diff --git a/public/docs/_examples/router/ts/app/auth.guard.ts b/public/docs/_examples/router/ts/app/auth.guard.ts index 68feb96883..52317985c1 100755 --- a/public/docs/_examples/router/ts/app/auth.guard.ts +++ b/public/docs/_examples/router/ts/app/auth.guard.ts @@ -1,20 +1,13 @@ // #docregion -import { Injectable } from '@angular/core'; -import { CanActivate, - Router, - ActivatedRouteSnapshot, - RouterStateSnapshot } from '@angular/router'; -import { AuthService } from './auth.service'; +import { Injectable } from '@angular/core'; +import { CanActivate, Router } from '@angular/router'; +import { AuthService } from './auth.service'; @Injectable() export class AuthGuard implements CanActivate { constructor(private authService: AuthService, private router: Router) {} - canActivate( - // Not using but worth knowing about - next: ActivatedRouteSnapshot, - state: RouterStateSnapshot - ) { + canActivate() { if (this.authService.isLoggedIn) { return true; } this.router.navigate(['/login']); return false; diff --git a/public/docs/ts/latest/guide/router.jade b/public/docs/ts/latest/guide/router.jade index c3d6d3a7ec..0f4ed85a2a 100644 --- a/public/docs/ts/latest/guide/router.jade +++ b/public/docs/ts/latest/guide/router.jade @@ -1052,7 +1052,7 @@ h2#guards Route Guards We'll examine other router guards in a future update to this chapter. :marked We can have multiple guards at every level of a routing hierarchy. - The router checks the `CanDeactive` guards first, from deepest child route to the top. + The router checks the `CanDeactivate` guards first, from deepest child route to the top. Then it checks the `CanActivate` guards from the top down to the deepest child route. If _any_ guard returns false, pending guards that have not completed will be canceled, and the entire navigation is canceled.