[Angular 2] *ngFor with index

时间:2022-06-16 19:22:44

Let's see how to track index when we use 'ngFor:

            <li *ngFor="#hero of heros | async, #i = index">
<hero-item [hero]="hero" (changed)="thisHero = $event;" [index]="i"></hero-item>
</li>

#i = index, simple as that :)

相关文章