ngForTemp
*ngFor = built-in directive , used for creating a HTML template by iterating over a collection.
* character before ngFor => a shortcut to create a parent template like ”template=ngFor let product of products”.
The above code will yield something like below:
*ngFor also provides a set of few pre-defined constants for each iteration of the for-loop:
index
= number => current iteration's index valuefirst
= boolean => is it the first iteration?last
= boolean => is it the last iteration?even
= boolean => is the current iteration index an even value?odd
= boolean => is the current iteration index an odd value?
This will generate HTML like below:
Last updated