i want to find index of elemnt in table in angular material . i write this code :
<table mat-table matSort [dataSource]="dataSource" multiTemplateDataRows>
<ng-container matColumnDef="title">
<th mat-header-cell *matHeaderCellDef> {{ 'GENERAL.TITLE' | translate }} </th>
<td mat-cell *matCellDef="let element ; let i = index">
<span class="icon" *ngIf="element.isHeading==true">
<mat-icon *ngIf="element.parentId==null" (click)="openChild(element.id,i)">keyboard_arrow_down</mat-icon>
</span> {{element.title}} </td>
</ng-container>
<!-- <ng-container matColumnDef="courseTitle">
<th mat-header-cell *matHeaderCellDef> {{ 'LESSON.COURSE_TITLE' | translate }} </th>
<td mat-cell *matCellDef="let element" ktIsEllipsisActive> {{element.courseTitle }} </td>
<ng-container matColumnDef="courseTitle">
<th mat-header-cell *matHeaderCellDef> {{ 'LESSON.CLASS' | translate }} </th>
<td mat-cell *matCellDef="let element" ktIsEllipsisActive> {{element.courseTitle }} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row;let i=index; columns: displayedColumns;"
[ngClass]="'child'+row.parentId"
[class.isChild]="row.parentId!==null && row.isHeading===false "></tr>
</table>
and i write this for find index :
*matCellDef="let element ; let i = index"
but every time it show me i is undefined
.
how can i access to index of item in <td>
?