【发布时间】:2018-08-26 10:34:00
【问题描述】:
打字稿代码:
helloworld(){
this.get_data().then(data => {
console.log(data);
});
}
get_data(){
return this.http.get('assets/data/user.json').map(res => res.json()).subscribe(data => {
return this.json_data = data;
});
}
任何人都可以告诉我为什么不工作。我该如何解决这个问题?对不起我的英语不好。
【问题讨论】:
-
你在 .sbscribe 上做 .then,这就是原因。看看这个:stackoverflow.com/q/34671715/5468463
标签: javascript angular ionic-framework ionic2 ionic3