title: Route Guard: How to make route guard true based on list sent by the server?
body: <p>I was trying to use route guard in my app that should let you go to a component only if the server sends you some parameters.</p>
  
  <p>This is the list of the parameters that the server can send me (not all of them are sent each time)</p>
  
  <pre><code>  AGREEMENTS_VIEW 
    PROSPECTS_VIEW
    AGREEMENTS_INSERT_UPDATE
    PRODUCTS_INSERT_UPDATE
    PROSPECTS_INSERT_UPDATE
    DOCUMENTS_VIEW
    DOCUMENTS_INSERT_UPDATE
  </code></pre>
  
  <p>My route guard:</p>
  
  <pre><code>@Injectable()
  export class UserRouteAccessService implements CanActivate {
      userActions=[];
      constructor(private router: Router, private securityService:CralSecurityService) {
       }
       securityActions(){debugger;
          this.securityService.securityActions().subscribe(
             (res: Array&lt;actions&gt;) =&gt; {
               this.userActions = res;
               console.log(res);
  
             });
         }
  
  
      canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
          this.securityActions();
  
          if (this.userActions = actions ) {
              return true;
          } else {
              return false;
          }
      }
  </code></pre>
  
  <p>Now how can I tell in the if that its true when some of the paramenters are sent or not? is userActions=[] correct?  For example it should go to "true" when AGREEMENTS_VIEW 
    PROSPECTS_VIEW are sent.</p>
  
  <p>Also, is this ok?</p>
  
  <pre><code>export class actions{
            AGREEMENTS_VIEW :string;
            PROSPECTS_VIEW :string;
            AGREEMENTS_INSERT_UPDATE :string;
            PRODUCTS_INSERT_UPDATE :string;
            PROSPECTS_INSERT_UPDATE :string;
            DOCUMENTS_VIEW :string;
            DOCUMENTS_INSERT_UPDATE :string;
  }
  </code></pre>
  
  <blockquote>
    <p>Http post:</p>
  </blockquote>
  
  <pre><code>securityActions(): &lt;Array&lt;any&gt;&gt; {
      return this.http.post&lt;Array&lt;any&gt;&gt;(
          `${this.ENDPOINT}/security-actions`,
          null,
      );
  }
  </code></pre>