ngFor 索引加 1 或计数加一

ngFor index plus 1 or incresed count by one

如何得到在angular2的索引却增加了1:

<li *ngFor="let mPrepTasks of project.upcomingMeetingsPrepTask; let i= index; let count = i+ 1;">
   <p>Index {{count}}</p>
</li>

为什么不这样做:

<li *ngFor="let mPrepTasks of project.upcomingMeetingsPrepTask; let i= index;">
   <p>Index {{i + 1}}</p>
</li>

您不能创建任意模板变量。在 *ngFor 中,您只能声明由 *ngFor 指令提供的变量。

要么按照@FilipLauc 所说的去做,要么在组件 class 中进行计算。