title: Angular 5 multiple Conditional Routing : "AuthGuards"
body: <p>i am trying to create conditional routing in angular 5 and i have seen this post and the official milestone page of angular:
  <a href="https://stackoverflow.com/questions/34660263/angular2-conditional-routing">Angular2 conditional routing</a>. </p>
  
  <p>But i didn't find a way to create multiple conditions based on input variables.
  here is my code : </p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import {CanActivate, Router, RouterStateSnapshot, ActivatedRouteSnapshot} from '@angular/router';
  import {AuthServiceService} from './auth-service.service';
  @Injectable()
  export class AuthguardService  implements CanActivate{
  
      constructor(
          private router: Router,
          private AuthService:AuthServiceService
      ) {}
  
      canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
          if(this.AuthService.ValidAs("User")!=true){
              this.router.navigate(['pages/login']);
              return false;
          }else{
            return true;
          }
      }
  
  }
  </code></pre>
  
  <p>My <code>AuthService.ValidAs()</code> method takes an argument to determine the type of user to try and validate as rightful to access a route and returns a boolean. i have three types of users, how do i pass extra arguments to the <code>canActivate</code> property in my routes in order to use that as argument to my <code>ValidAs</code> method. </p>
  
  <p>If there is any other way to create multiple <code>canActivate</code> instances without multiplying files, let me know.</p>