如何使用ng repeat
将多个数组数据加载到指令templateURL<div> <table> <tr> <td>h1</td> <td>v1</td> </tr> </table> </div>
<div> <table> <tr> <td>h2</td> <td>v2</td> </tr> </table> </div>
<div> <table> <tr> <td>h3</td> <td>v3</td> </tr> </table> </div>
指令控制人:
$scope.data =[[{ h:'H1', v:'V1'}][{ h:'H2', v:'V2'}][{ h:'H3', v:'V3'}]];
$scope.updateData = $scope.data;
模板结构:
<div ng-repeat="fields in updateData">
<table>
<tr>
<td>{{f.h}}</td>
<td>{{f.v}}</td>
</tr>
</table></div>
答案 0 :(得分:2)
只需在ng-repeat
<tr>
即可
<div ng-repeat="fields in updateData">
<table>
<tr ng-repeat="f in fields">
<td>{{f.h}}</td>
<td>{{f.v}}</td>
</tr>
</table>
</div>