Ionic 2 || AngularJS 2 - Print an index value in *ngFor

Printing an iteration count in *ngFor at an AngularJS view can be done using index. Check the following code to print the iteration count.

 

<div ion-item *ngFor="let item of items; let i = index;">
    <div class="iterations">codeexpertz--> iteration {{i}}></div>
</div>
 
// for ionic 2 beta versions
 
 
<div ion-item *ng-for="#item of items; #i = index;">
    <div class="iterations">codeexpertz--> iteration {{i}}></div>
</div>
 
where items is an array, i is the current iteration count starts from 0
Output:
codeexpertz--> iteration 0
codeexpertz--> iteration 1
codeexpertz--> iteration 2
Category: