ngFor with index as value in attribute in angular 12
I have a ngFor loop which keeps track of the current index. I want to store that index value in an attribute.
<ul *ngFor="#item of items; #i = index" data-index="#i"> <li>{{item}}</li> </ul>
I want to store the value of #i in the attribute data-index.
Can any one guide me how to do this ?
Thanks.
Add comment