【发布时间】:2019-12-14 01:00:57
【问题描述】:
我正在使用 IONIC,我正在从 Service Rest 读取数据,我想在主页中显示这些数据,但每次我得到一个字符串时,任何人都可以帮助我。
home.ts
AfficherT(){
var url='http://localhost:8888/ticketF';
console.log("Clickeed");
this.result = this.http.get(url)
this.result.subscribe(data => {
this.chaine=JSON.stringify(data);
});
}
home.html
<ion-list>
{{chaine}}
</ion-list>
【问题讨论】:
-
你想如何显示这些数据?
-
在比字符串更好的列表或数组中
-
删除
JSON.stringify(...)。之后,您可以访问 json 的 any 属性。例如:{{ data.ticket }}等 -
它给了我[对象] [对象]
标签: angular typescript ionic-framework ionic3