title: Angular 8 - How to use Promises and Async/Await
body: <p>I keep trying to use tutorials but can't seem to figure out how to use Promises or async await.  </p>
  
  <p>I have an http GET request and I want to wait for the result from the API before returning.  The coming back as null because the function returns before the GET occurs.</p>
  
  <p>HTTP GET</p>
  
  <pre><code>get_UserAccess(practiceId: number, userId: number): UserAccess {
      var d: UserAccess;
  
      this.httpclient.get(this.URL).subscribe.(data =&gt; {
        d = data as UserAccess;
      });
  
      return d; //Keeps returning as null
  </code></pre>
  
  <p>Calling Component</p>
  
  <pre><code>var userAccess = this.dataService.get_UserAccess(this.practice.practiceId, this.users[i].userId);
  this.loadAccess(userAccess);
  </code></pre>
  
  <p>I've tried adding the await and async tags to the get request, but I'm not sure how to work with the promise that it returns to the calling component..</p>