mat-table [dataSource] get index of code example
Example: material table get index of row
<ng-container matColumnDef="position">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Num. </th>
<td mat-cell *matCellDef="let element; let i = index">{{i + 1}}</td>
</ng-container>