title: Angular2: Route redirect with AuthGuard
body: <p>I've an Angular2 app that should block route to a certain page if user is not logged in. This is my app.routes file</p>
  
  <pre><code>export const routes: Routes = [
    { path: '', component: LoginComponent },
    { path: 'login', component: LoginComponent },
    { path: 'home', component: HomeComponent, canActivate: [AuthGuard] },
    { path: '**', component: LoginComponent },
  ];
  </code></pre>
  
  <p>and my AuthGuard file</p>
  
  <pre><code>@Injectable()
  export class AuthGuard implements CanActivate {
  response: ResponseInterface;
  
  constructor(private router: Router, private localStorage: LocalStorageService,
   private services: MyService) { }
  canActivate() {
  
  let token = String(this.localStorage.get('token'));
  if (token != null) {
    this.services.keepAlive(token).subscribe(
      response =&gt; this.response = response,
      error =&gt; alert(error),
      () =&gt; {
        if (this.response.status == 'OK') {
          console.log("response OK");
          return true;
        } else {
          console.log("response KO");
          this.router.navigate(['/login']);
          return false;
        }
      }
    )
  
  } else {
    this.router.navigate(['/login']);
    return false;
  }
  </code></pre>
  
  <p>now, if i try to navigate to <a href="http://localhost:4200/#/home" rel="nofollow noreferrer">http://localhost:4200/#/home</a> path and I already have a token stored into localStorage, nothing happen: home page is not showed and path on navigation bar become <a href="http://localhost:4200/#/" rel="nofollow noreferrer">http://localhost:4200/#/</a>.
  What's wrong?</p>