1<ul>
2 <li *ngFor="let item of items; let i = index" [attr.data-index]="i">
3 {{item}}
4 </li>
5</ul>
1
2 <li *ngFor="let item of items; index as i; trackBy: trackByFn">...</li>
3
1 <td *ngFor="let col of options.cols;index as i">
2 {{item[i]}} //Angular solution
3 </td>
1//for
2<div *ngFor='let [data] of [dataArray]; let i=index;'>
3 <h2> {{i}} {{data.title}} </h2>
4 <img src='{{data.image}}' />
5 </div>
6 //the data contained in an array will be displayed element by element
7 //similar to the function .map() in React
8