So it is clear how to get an index value for the rows when rendering a table according to the guide for Angular Material .. you can do this
<tr mat-row *matRowDef="let row; columns: displayedColumns;let i = index" (click)="debug(i)"></tr>
But what about the index for the column? it seems tricky because we are not using any traditional for loops to generate the columns but rather we are assigning it directly in *matRowDef as you see above.
And we are defining our columns like this..
<ng-container matColumnDef="returnToService">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Returned To Service </th>
<td mat-cell *matCellDef="let workOrder"> {{formatDate(workOrder.returnToService)}} </td>
</ng-container>
<ng-container matColumnDef="requestDate">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Work Order Reported Date </th>
<td mat-cell *matCellDef="let workOrder"> {{formatDate(workOrder.requestDate)}} </td>
</ng-container>
I see no way of getting index in *matHeaderRowDef here..
<tr mat-header-row *matHeaderRowDef="displayedColumns; let i = ???" (click)="debug(??)"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;let i = index" (click)="debug(i)"></tr>