[Angular 2] *ngFor with index
Posted Answer1215
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Angular 2] *ngFor with index相关的知识,希望对你有一定的参考价值。
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 :)
以上是关于[Angular 2] *ngFor with index的主要内容,如果未能解决你的问题,请参考以下文章