title: How to access class variable inside Promise then() function?
body: <p>I'm working on a Angular4 + PHP website, where i send HTTP requests to the server using Promise, since i want my application to perform routing according to the response of the server. I want to access a class variable inside the then() but it throws <code>undefined()</code> error.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>status = false;
  
  checkUser(): Promise&lt;any&gt;{
  // .....
      return this.http
          .get('http://localhost:8000/api/user', this.options)
          .toPromise()
          .then(this.extractData)
          .catch(this.handleError);
  }
  
  private extractData(res: any) {
      data = res.json();
      this.status = data.status; // here it throws error undefined 
      return this.status; 
  }
  </code></pre>
  
  <p>Is there any other way to implement this?</p>