Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

docs(router): changes suggested by DeborahK in #1808 #1837

Merged
merged 1 commit into from
Jul 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions public/docs/_examples/router/ts/app/auth.guard.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion public/docs/ts/latest/guide/router.jade
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down