Skip to content

Commit d1dd2b8

Browse files
committed
docs(router): changes suggested by Deb Kurata in angular#1808
1 parent 962b215 commit d1dd2b8

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

public/docs/_examples/router/ts/app/auth.guard.ts

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
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()
107
export 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;

public/docs/ts/latest/guide/router.jade

+1-1
Original file line numberDiff line numberDiff 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.

0 commit comments

Comments
 (0)