export class HomePage {
public news:Object;
constructor(public navCtrl: NavController,public httpdata:HttpdataproviderProvider) {
this.news = {};
this.getAllNews();
}
getAllNews(){
let url = 'some url';
this.httpdata.httpPost(url,someData) //some custom provider
.then(function(data){
console.log(this.news);
this.news = data;
})
}
}
Why can't I access the news object or assign data to news . Its showing 'Cannot read property 'news' of undefined'