Search code examples
angularangular2-templateangular2-directives

ngFor index plus 1 or incresed count by one


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>

Solution

  • Why not just do this:

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