I have some JSON data structured as:
[{"x":"Example1", "y":["1","2","3"],"id":"one"},{"x":"Example2", "y":["11","12","13"],"id":"two"}]
I am trying to bind the data so it shows:
One
1 2 3
Two
11 12 13
I'm pretty sure I'm doing this entirely wrong, but can't seem to get my head around it...! I can get a result using {{item.y[0]}}
, but can't do this nested *ngFor
.
<ion-item *ngFor="let item of Data">
<h2>{{item.id}}</h2>
<h3 *ngFor="let y of item">{{item.y}}</h3>
</ion-item>
Thank you in advance for any help.
我认为您要执行的操作如下:
<h3 *ngFor="let y of item.y">{{y}}</h3>
<ion-item *ngFor="let item of Data">
<h2>{{item.id}}</h2>
<h3 *ngFor="let y of item.y">{{y}}</h3>
</ion-item>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.