Set some additional variables to the index
and use them in your (click) handler:
<tbody>
<tr *ngFor="let subarray of myarray2; let i = index;">
<td *ngFor="let item of subarray; let j = index;">
{{item}}
<span tabindex="0" (click)="someMethod(i, j)">+</button>
</td>
</tr>
</tbody>
I managed to get as parameters with help of the comment.This one also works .Thanks a lot
html
<tbody>
<tr *ngFor="let i of myarray2 ; let indx1 = index" [attr.data-index]="indx1">
<td *ngFor="let j of i ; let indx2 = index" [attr.data-index]="indx2" > {{j}}
<button *ngIf="j=='0.0 h'" (click)="getIndexofTable(indx1, indx2)" class="fa fa-plus" > </button>
</td>
</tr>
typescript
getIndexofTable(index_value:number,index_value2:number){ }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.