Reputation: 1071
I need to have an *ngFor
of table rows, where each repetition consists in 2 rows, as shown here.
But in Angular the repetition is done for each row, not each 2:
<table>
<tr *ngFor="let row of rows; let i = index">
<td>{{row.somethingA}}</td>
<td>{{row.somethingB}}</td>
</tr>
</table>
What is the best way to approach this?
Upvotes: 2
Views: 260
Reputation: 14679
You can always use an ng-container
.
<ng-container *ngFor="let row of rows; let i = index">
<tr>{{ row.something }}</tr>
<tr>{{ row.somethingElse }}</tr>
</ng-container>
Upvotes: 5