How can I call a class method inside a promise in Angular 2? : <p>If I have an Angular 2 component and I get data from a service that returns an async promise or observable how can I then call a method in the component to display that data?</p>

<pre><code>@Component({
  moduleId: module.id,
  selector: 'charts',
  templateUrl: 'charts.component.html',
  providers: [DataService]
})
export class ChartsComponent implements OnInit {

  constructor(private dataService:DataService)

  ngOnInit() {
    this.getData();
  }

  getData(){
    this.dataService.getData().then(function (data) {
      this.drawChart(data);
    });
  }

  drawChart(){
     //implement drawing chart
  }
}
</code></pre>

<p>The problem is that inside a promise "this" in "this.drawChart()" no longer refers to the ChartsComponent class.  How can I call a class method post promise?</p>

<p>Also, I cant put drawChart() inside the promise because it needs to use other class properties.</p>
