title: Angular : How to handle the async set of a variable
body: <p>Under my <strong>Angular 6</strong> app , i have this service ; where i'm declaring a varibale called <strong>permittedPefs</strong> , this variable is setted asychronsouly within a <code>httpClient.get</code> call.</p>
  
  <pre><code>@Injectable()
      export class myService implements OnInit {
  
        permittedPefs = [];
        constructor(){}
  
        ngOnInit() {
        // STEP 1
        this.loadUserPefsService.getUserRolePefs(roleId).subscribe(
            (returnedListPefs) =&gt; {
              this.permittedPefs = returnedListPefs;
            },
            error =&gt; {
              console.log(error);
            });
        }
        // STEP 2
        this.myMethod(1);
  </code></pre>
  
  <p>After that , i ve a call of this method which is using my <strong>-supposed setted -</strong> var</p>
  
  <pre><code>myMethod(pefId): boolean {
          return this.permittedPefs.includes(pefId);
  }
  </code></pre>
  
  <p>the problem is it seems that <strong>permittedPefs</strong> , haven't got its value yet , and the call of <code>myMethod()</code> point to a wrong value of "<strong>permittedPefs</strong>"</p>
  
  <p>So what's the simpliest way <strong>to make it wait to the just after the http response</strong> , without calling if from the http Response callback <em>(as i 'm using it in several places)</em> </p>
  
  <p><strong><em>Sugesstions??</em></strong></p>