0
我想循環通過我的json數組。 的Jsons是:Ionic 2通過JSON從其他服務環路中循環
{
"0": {
"id": "678",
"name": "Several Definitions (VD) - Podcast 104 - ubwg.ch",
"artist": {
"id": "282",
"name": "Unsere Beweggründe (CH)",
"soundcloudId": 3473917,
"facebookId": null
},
"day": "2017-01-06",
"soundcloudTrackId": "277888181"
},
"1": {
"id": "677",
"name": "Maedchenhouse Vol. 13",
"artist": {
"id": "1089",
"name": "maedchenhouse",
"soundcloudId": 73887525,
"facebookId": null
},
"day": "2017-01-05",
"soundcloudTrackId": "192561213"
},
"hasAnother": true
}
這裏是我的離子HTML文件:
<ion-grid *ngFor="let set of sets">
<ion-card>
<img src="https://i1.sndcdn.com/artworks-000174566284-nngazk-t300x300.jpg"/>
<ion-card-content>
<ion-card-title>
{{set.name}}
</ion-card-title>
<p>
The most popular industrial group ever, and largely
responsible for bringing the music to a mass audience.
</p>
</ion-card-content>
</ion-card>
</ion-grid>
這也是我如何分析它:
public generateSets(data){
\t this.sets = JSON.parse(data);
\t alert(this.sets[0].name);
}
順便說一句提醒的作品,但我不知道如何更新我的離子HTML文件中的網格。 沒有循環的{{set [0] .name}}不起作用。 有人有想法嗎? 問候