AngularJS 1.2 ng-repeat
handle multiple elements with ng-repeat-start
and 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>
Output:
Items |
---|
Item 1: Row 1 |
Item 1: Row 2 |
Item 2: Row 1 |
Item 2: Row 2 |