title: CanActivateGuard and passing data into the Guard
body: <p>I have an angular 4 app, and have implemented a guard to handle authentication. We have different modules which, use a factory to create what we call a ThemeService. Each module is self contained application with their own styles, and security. Each module tells the ThemeService what role the user must have to access and the guard works well.</p>
  
  <p>Here's the guard:</p>
  
  <pre><code> export class AuthenticatedGuard implements CanActivate
      {
          constructor (private memSrv:MembershipService,
  private themeSrv:ThemeService,private router:Router )
          {
          }
          canActivate(
              route: ActivatedRouteSnapshot,
              state: RouterStateSnapshot
          ): Observable&lt;boolean&gt; | Promise&lt;boolean&gt; | boolean {
  
              return this.memSrv.GetCurrentUser()
                  .map(u =&gt; {
                      if (!u) {
                          this.router.navigate([this.themeSrv.LoginUrl]);
                          return false;
                      }
                      var isAuth = u.Capabilities.some(s =&gt; s === this.themeSrv.AuthCapability);
                      if (isAuth) {
                          return true;
                      }
                      else {
                          //TODO: This is an unauthorized but authenticated user it should go to an unauthorized page
                          this.router.navigate(["/Unauthorized", { url: state.url }]);
                          return false;
                      }
                  }
                  );
  
  
          }
      }
  </code></pre>
  
  <p>I now have a module which has some routes which need to be secured using a different role. My question is how I can pass to the AuthenticationGuard the role that must be checked for each route. I'd hate to have to create a different guard for each role we want to check.</p>
  
  <p>Bellow is a snippet of my route configuration</p>
  
  <pre><code>   {
          path: "",
          component: Component.MainComponent, 
          children:
          [
              {
                  path: 'attachmentsTest',
                  component: Component.AttachmentsTestComponent,
              },
              {
                  path:"home",
                  component: Component.HomeComponent,
                  canActivate: [AuthenticatedGuard],
                  resolve: {
                      user: CurrentUserResolver
                  }
              }, 
  </code></pre>