【发布时间】:2019-01-04 15:59:32
【问题描述】:
我正在尝试在表格中显示数据。
行和列是动态的。
我想使用ng-repeat。
我正在以这种形式接收数据:
headers: [
0: {"heading1"},
1: {"heading2"},
2: {"heading3"}
]
data: [
0:{ id:1, code:"Barry" , description:"Allen" }
1:{ id:2, code:"Naruto" , description:"Uzumaki" }
2:{ id:3, code:"Hannah" , description:"Montana" }
]
我试过这样:
<thead>
<tr>
<td ng-repeat="c in headersData">
{{c}}
</td>
</tr>
</thead>
<tbody>
<tr ng-repeat="c in columnData">
<td>{{c.id}}</td>
<td>{{c.code}}</td>
<td>{{c.description}}</td>
</tr>
</tbody>
但它不会渲染thead。
有什么解决办法吗?
【问题讨论】:
标签: angularjs html-table angularjs-ng-repeat