ngfor index
<ul>
<li *ngFor="let item of items; let i = index" [attr.data-index]="i">
{{item}}
</li>
</ul>/*
ngFor with index in angular is used here for generating 'li' element till the studentDetails array length.
And also make a note if you are using angular 1 then you have to replace 'let' with '#', but its ok if you are using angular 2 or above.
*/
<ul>
<li *ngFor="let student of studentDetails; index as i;" [attr.data-index]="i">
{{student}}
</li>
</ul>
/*
I hope it will help you.
Namaste
*/<ul>
<li *ngFor="let item of items; let i = index" [attr.data-index]="i">
{{item}}
</li>
</ul><ul>
<li *ngFor="let item of items; index as i">
{{item}}
</li>
</ul><ul>
<li *ngFor="let item of items; let i = index" [attr.data-index]="i">
{{item}}
</li>
</ul><ul>
<li *ngFor="let item of items; let i = index" [attr.data-index]="i">
{{item}}
{{i}}
</li>
</ul>
Also in JavaScript:
- replace all character in string javascript
- function para mter js
- vue js implementation
- fillstyle
- javascript sort array smallest to largest
- notification dropdown bootstrap
- chai compare arrays
- how to check if map is map javascript
- ngfor index
- js stop form submit
- nuxt eslint prettier vetur
- view background image in react native
- how to run mocha tests on asynchronous functions in script
- javascript clone object
- javascript convert Object.entries back to object
- vuejs show content on loaded
- create stack navigator has been moved to react-navigation-stack
- Unable to resolve "react-navigation-stack" react native
- check if isset variable js
- query selector has clas
- lodash remove undefined values from object
- Cannot find module '@angular/cdk/a11y'
- javascript check if two date ranges overlap
- find key in nested json object