我拿到的数据:
var items=[
{ "version": "1", "theme": "Windstorm" ,"age":20},
{ "version": "2", "theme": "Bombasto","age":21},
{ "version": "3", "theme": "Magneta" ,"age":22},
{ "version": "4", "theme": "Tornado" ,"age":23}
];
我的template:
<p>
<p> <tr *ngFor="let item of items"> <td *ngFor="怎么写">怎么写</td> </tr> </p> </p>
我想对item里的key再进行遍历,拿到对应的value循环渲染到
<td>
元素中.我的template该怎么写?
...
ng2
这点让我非常不爽,居然不能天然遍历Object
, we can only write it ourselves, in order not to confuse you, I use the simplest way to play,First is the
template
part:The following is the
Component
logical part:The method definitely works, just try it and see for yourself
keys.pipe.ts
app.component.ts