1
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;
})
}
}
爲什麼我不能訪問新聞對象或將數據分配給新聞。它顯示「無法讀取屬性‘離子2無法讀取未定義的屬性'新聞'
你的回調應該是箭頭功能.. –