How to get in angular 2 the index but increased by 1:
<li *ngFor="let mPrepTasks of project.upcomingMeetingsPrepTask; let i= index; let count = i+ 1;">
<p>Index {{count}}</p>
</li>
Why not just do this:
<li *ngFor="let mPrepTasks of project.upcomingMeetingsPrepTask; let i= index;">
<p>Index {{i + 1}}</p>
</li>
You can't create arbitrary template variables. Inside *ngFor
you can only declare variables that are provided by the *ngFor
directive.
Either do what @FilipLauc said or do the calculation in the component class instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With