我有以下格式的 JSON:
[
{Details: [{name: "WII", type:"Video Games", id:"lint"}]
]
但是在表中的 UI 上,我想首先在第一列中显示 ID,然后是其他列。
让我们假设这是您的 JS 数据结构:
let list = [
{ Details: [{ name: "WII", type: "Video Games", id: "lint" }] }
];
然后在你的 Angular 组件模板中:
<table>
<tr *ngFor="let item of list" >
<td>{{item.Details[0].id}}</td>
<td>{{item.Details[0].name}}</td>
<td>{{item.Details[0].type}}</td>
</tr>
</table>
当然,这并不理想,但为了给您一个更好的答案/解决方案,您应该提供更多信息。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句