有人能告诉我如何在数据结构下迭代吗?我在试着加载正常的引导表。但失败了。到目前为止,我尝试在一个for..loop循环中使用for of。但它在“”上返回未定义的
我知道这是个愚蠢和重复的问题。但我找不到解决办法。
{
"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",
}
]
}
}发布于 2019-09-17 14:32:31
就像这样:
<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>https://stackoverflow.com/questions/57976435
复制相似问题