title: Angular2 need the result of a async get to allow access to a route
body: <p>I'm using a AuthGuard to protect my routes, making sure that a user is logged in correctly before he gets to see the dashboard of the app.</p>
  
  <p>AuthGuard:</p>
  
  <pre><code>canActivate(
      next:  ActivatedRouteSnapshot,
      state: RouterStateSnapshot
    ) {
      // return true;
      return this.userService.getValidLoginCheck();
  }
  </code></pre>
  
  <p>However The getValidLoginCheck() does not return a boolean:</p>
  
  <pre><code>getValidLoginCheck(): boolean {
      let headers = new Headers();
  
      let options = new RequestOptions({ headers: headers });
  
      headers.append('authorization', this.getToken());
  
      this.http.get(this.baseUrl + 'api/auth/checkToken', options)
        .map(res =&gt; res.json())
        .subscribe(data =&gt; {return data.message === 'valid token' });
  
    }
  </code></pre>
  
  <p>I know why this is happening, but how can I make the getValid... function wait for the http.get to finish so I can guard my routes correctly?</p>