title: How to apply canActivate guard on all the routes?
body: <p>I have a angular2 active guard which handle if the user is not logged in, redirect it to login page:</p>
  
  <pre><code>import { Injectable } from  "@angular/core";
  import { CanActivate , ActivatedRouteSnapshot, RouterStateSnapshot, Router} from "@angular/router";
  import {Observable} from "rxjs";
  import {TokenService} from "./token.service";
  
  @Injectable()
  export class AuthenticationGuard implements CanActivate {
  
      constructor (
          private router : Router,
          private token : TokenService
      ) { }
  
      /**
       * Check if the user is logged in before calling http
       *
       * @param route
       * @param state
       * @returns {boolean}
       */
      canActivate (
          route : ActivatedRouteSnapshot,
          state : RouterStateSnapshot
      ): Observable&lt;boolean&gt; | Promise&lt;boolean&gt; | boolean {
          if(this.token.isLoggedIn()){
              return true;
          }
          this.router.navigate(['/login'],{ queryParams: { returnUrl: state.url }});
          return;
      }
  }
  </code></pre>
  
  <p>I have to implement it on each route like :</p>
  
  <pre><code>const routes: Routes = [
      { path : '', component: UsersListComponent, canActivate:[AuthenticationGuard] },
      { path : 'add', component : AddComponent, canActivate:[AuthenticationGuard]},
      { path : ':id', component: UserShowComponent },
      { path : 'delete/:id', component : DeleteComponent, canActivate:[AuthenticationGuard] },
      { path : 'ban/:id', component : BanComponent, canActivate:[AuthenticationGuard] },
      { path : 'edit/:id', component : EditComponent, canActivate:[AuthenticationGuard] }
  ];
  </code></pre>
  
  <p>Is there any better way to implement canActive option without adding it to each path.</p>
  
  <p>What I want is to add it on main route, and it should apply to all other routes. I have searched alot, but I could not find any useful solution</p>
  
  <p>Thanks</p>