Could some one tell me how to iterate below data structure. ii'm trying to load in normal bootstrap table. but failed. so far i tried to for..loop
inside an for of
loop. but it returns undefined on ' tableData
'
i know its silly and duplicate question. but i don't find solution.
{
"parent":{
"tableHeading":{
"Header1":"ASD",
"Header2":"QQQ",
"Header3":"YYY",
"Header4":"OOO",
},
"tableData":[
{
"Sample_1":"2019-08-19T00:00:00",
"Sample_2":"Johney",
"Sample_3":"30",
"Sample_4":"PA,
},
{
"Sample_1":"2019-08-19T00:00:00",
"Sample_2":"Allen P",
"Sample_3":"29",
"Sample_4":"SA",
},
{
"Sample_1":"2019-08-19T00:00:00",
"Sample_2":"Chris",
"Sample_3":"28",
"Sample_4":"MM",
}
]
}
}
Try like this:
<table border="1">
<tr>
<td *ngFor="let head of data.parent.tableHeading |keyvalue">
{{head.value}}
</td>
</tr>
<tr *ngFor="let item of data.parent.tableData">
<td *ngFor="let element of item | keyvalue">
{{element.value}}
</td>
</tr>
</table>
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.