I'm using Angular Material to render the table.
Code:
<ng-container matColumnDef="type">
<th mat-header-cell *matHeaderCellDef> Workout type </th>
<td mat-cell *matCellDef="let workout"> {{workout.type}} </td>
</ng-container>
<ng-container matColumnDef="set1">
<th mat-header-cell *matHeaderCellDef> Weight x Reps </th>
<td mat-cell *matCellDef="let workoutData"> {{workoutData.workoutSessions[0].sets[0].weight}} x {{workoutData.workoutSessions[0].sets[0].repetitions}} </td>
</ng-container>
<ng-container matColumnDef="set2">
<th mat-header-cell *matHeaderCellDef> Weight x Reps </th>
<td mat-cell *matCellDef="let workoutData"> {{workoutData.workoutSessions[0].sets[1].weight}} x {{workoutData.workoutSessions[0].sets[1].repetitions}} </td>
</ng-container>
<ng-container matColumnDef="set3">
<th mat-header-cell *matHeaderCellDef> Weight x Reps </th>
<td mat-cell *matCellDef="let workoutData"> {{workoutData.workoutSessions[0].sets[2].weight}} x {{workoutData.workoutSessions[0].sets[2].repetitions}} </td>
</ng-container>
<ng-container matColumnDef="set4">
<th mat-header-cell *matHeaderCellDef> Weight x Reps </th>
<td mat-cell *matCellDef="let workoutData"> {{workoutData.workoutSessions[0].sets[3].weight}} x {{workoutData.workoutSessions[0].sets[3].repetitions}} </td>
</ng-container>
<ng-container matColumnDef="set5">
<th mat-header-cell *matHeaderCellDef> Weight x Reps </th>
<td mat-cell *matCellDef="let workoutData"> {{workoutData.workoutSessions[0].sets[4].weight}} x {{workoutData.workoutSessions[0].sets[4].repetitions}} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="workoutTableColumns"></tr>
<tr mat-row *matRowDef="let row; columns: workoutTableColumns;"></tr>
I have 2 questions about this:
1) Is it possible to iterate thru an array using *ngFor in this situation? Now my code looks too messy, want to clean it.
2) Is it possible to use colspan? I didn't find any information that this issue is solved (issue: https://github.com/angular/material2/issues/5888 ).
So, the main quesion is: Is it better to use Angular material table or regular one in this particular situation?