ng-repeat-start ng-repeat-end
AngularJS 1.2 ng-repeat
使用 ng-repeat-start
和 ng-repeat-end
處理多個元素:
// table items
$scope.tableItems = [
{
row1: 'Item 1: Row 1',
row2: 'Item 1: Row 2'
},
{
row1: 'Item 2: Row 1',
row2: 'Item 2: Row 2'
}
];
// template
<table>
<th>
<td>Items</td>
</th>
<tr ng-repeat-start="item in tableItems">
<td ng-bind="item.row1"></td>
</tr>
<tr ng-repeat-end>
<td ng-bind="item.row2"></td>
</tr>
</table>
輸出:
Items |
---|
Item 1: Row 1 |
Item 1: Row 2 |
Item 2: Row 1 |
Item 2: Row 2 |