<ul> <li *ngFor="let item of items; let i = index" [attr.data-index]="i"> {{item}}
<i (click)="deleteThis(i)">x</i> </li> </ul>
angular4 *ngFor获取index
最新推荐文章于 2021-04-22 15:52:08 发布
<ul> <li *ngFor="let item of items; let i = index" [attr.data-index]="i"> {{item}}
<i (click)="deleteThis(i)">x</i> </li> </ul>