in your mat-cell
you can get index like *ngFor
as below
<mat-cell *matCellDef="let element;let i = index;">
{{ i }}
</mat-cell>
Update from Angular 5 use also index as i
<ng-container matColumnDef="rowIndex">
<th mat-header-cell *matHeaderCellDef> Index </th>
<td mat-cell *matCellDef="let element;index as i;"> {{ i }} </td>
</ng-container>
index
: number: The index of the current item in the iterable.
first
: boolean: True when the item is the first item in the iterable.
last
: boolean: True when the item is the last item in the iterable.
even
: boolean: True when the item has an even index in the iterable.
odd
: boolean: True when the item has an odd index in the iterable.