我正在开发一个调用微服务的应用程序,这些服务将返回下一个JSON:
{
"result": "OK",
"message": null,
"columns": [
{
"name": "Id-1",
"order": 0,
"values": [
{
"value": "cf"
},
{
"value": "13"
},
{
"value": "9c"
},
{
"value": "5a"
},
{
"value": "1c"
},
{
"value": "45"
},
{
"value": "b"
}
]
},
{
"name": "Name",
"order": 1,
"values": [
{
"value": "prueba"
},
{
"value": "TEST"
},
{
"value": "Op"
},
{
"value": "Op"
},
{
"value": "P"
},
{
"value": "PruebaTest"
},
{
"value": "nal"
}
]
}
]
}
想法是在我的表中<th>
的列名和<td>
值中显示。像这样:
我试图用几个* ngFor来做,但是我没有得到正确的结果。我该怎么做?
尝试这个
<table>
<tr>
<td *ngFor="let d of data.columns">
<table>
<tbody>
<tr>
{{d.name}}
</tr>
<tr *ngFor="let main of d.values">
<td>
{{main.value}}
</td>
</tr>
</tbody>
</table>
<td>
</tr>
</table>
工作连结
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句