vd sanduni
vd sanduni

Reputation: 1

How to get row index of a mat table, through its input field event passing?

My table has one input column which is type = numeric. When I passed it's value for its .ts file I have used both keyup and change events. This includes in the one of column. Now i need to pass the row index through above both events. How can I do it?

Contribution Percentage %

Upvotes: -1

Views: 628

Answers (1)

Abhishek Agarwal
Abhishek Agarwal

Reputation: 180

you can use index in row like this

  <ng-container matColumnDef="name">
    <th mat-header-cell *matHeaderCellDef> Name </th>
    <td mat-cell *matCellDef="let element let i= index"> <input (keyup)=function(i)></td>
  </ng-container>

you can also read about trackBy

Upvotes: 1

Related Questions