title: Using a base guard for all routes in Angular 2 application
body: <p>Is there a way to set a "base" <code>canActivate</code> when configuring routes in Angular2? So that all routes are covered by the same base check, and then each route can have a more granular check.</p>
  
  <p>I have an <code>AppModule</code> with routing like this:</p>
  
  <pre><code>@NgModule({
      imports: [
          RouterModule.forRoot([
              {
                  path: '',
                  component: HomeComponent,
                  canActivate: [AuthenticationGuardService],
                  data: { roles: [Roles.User] }
              }
          ])
      ],
      exports: [
          RouterModule
      ]
  })
  export class AppRoutingModule { }
  </code></pre>
  
  <p>And for the feature module <code>FeatureModule</code>:</p>
  
  <pre><code>@NgModule({
      imports: [
          RouterModule.forChild([
              {
                  path: "feature",
                  component: FeatureComponent,
  
                  // I'd like to avoid having to do this:
                  canActivate: [AuthenticationGuardService],
                  data: { roles: [Roles.User] }
              }
          ])
      ],
      exports: [
          RouterModule
      ]
  })
  export class FeatureRoutingModule { }
  </code></pre>
  
  <p>I let <code>AuthenticationGuardService</code> check if a user has access to a route by using the roles provided in <code>data</code>.</p>
  
  <p>Can I do something to avoid having to set <code>canActivate</code> and <code>data</code> in all my feature routing modules? I'd like to just configure a "base" <code>canActivate</code> for all routes in this application.</p>