javascript / beginner
Snippet
Iterating Arrays with *ngFor
The *ngFor directive repeats a template for each item in a list or array, making it essential for rendering collections.
snippet.js
1
2
3
<ul><li *ngFor="let fruit of fruits">{{ fruit }}</li></ul>
angular
Breakdown
1
let fruit of fruits
Defines a local variable 'fruit' for the current item in the 'fruits' array.