This repository was archived by the owner on Dec 4, 2017. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-12
lines changed
Expand file tree Collapse file tree 2 files changed +5
-12
lines changed Original file line number Diff line number Diff line change 11// #docregion
2- import { Injectable } from '@angular/core' ;
3- import { CanActivate ,
4- Router ,
5- ActivatedRouteSnapshot ,
6- RouterStateSnapshot } from '@angular/router' ;
7- import { AuthService } from './auth.service' ;
2+ import { Injectable } from '@angular/core' ;
3+ import { CanActivate , Router } from '@angular/router' ;
4+ import { AuthService } from './auth.service' ;
85
96@Injectable ( )
107export class AuthGuard implements CanActivate {
118 constructor ( private authService : AuthService , private router : Router ) { }
129
13- canActivate (
14- // Not using but worth knowing about
15- next : ActivatedRouteSnapshot ,
16- state : RouterStateSnapshot
17- ) {
10+ canActivate ( ) {
1811 if ( this . authService . isLoggedIn ) { return true ; }
1912 this . router . navigate ( [ '/login' ] ) ;
2013 return false ;
Original file line number Diff line number Diff line change @@ -1052,7 +1052,7 @@ h2#guards Route Guards
10521052 We'll examine other router guards in a future update to this chapter.
10531053:marked
10541054 We can have multiple guards at every level of a routing hierarchy.
1055- The router checks the `CanDeactive ` guards first, from deepest child route to the top.
1055+ The router checks the `CanDeactivate ` guards first, from deepest child route to the top.
10561056 Then it checks the `CanActivate` guards from the top down to the deepest child route.
10571057 If _any_ guard returns false, pending guards that have not completed will be canceled,
10581058 and the entire navigation is canceled.
You can’t perform that action at this time.
0 commit comments