I\'m trying to get the index of row in table, in html, which has been implemented using angular material v5.2. Is there any method available to get the index?
The co
I know this post is old but the above solution didn't work for me.
instead if let i = index;
try let i = dataIndex
for latest version of mat-table check
this solution. Don't know if it's just for expandable table though
Anyone using Angular6+ should use let i = dataIndex
instead of let i = index
as explained in this Github issue.
Here's the HTML snippet
<ng-container matColumnDef="position">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Num. </th>
<td mat-cell *matCellDef="let element; let i = dataIndex">{{i + 1}}</td>
</ng-container>