Adding Logic with Directives: ngFor

This is the Angular For Loop which means it repeat the portion of DOM tree once for each item in iterable list. We define a block of HTML that defines how we want to display the single item and tell angular to use that block for displaying each item in the list.

Code Structure



In the above code,
'product' is a name of variable denoted by 'let' keyword for 'products' property name
To get each dynamic value, we make use of that variable name 'product' with each property name mentioned in object

We also have used the following code 'let product of products' instead of 'let product in products' because:

Share this

Related Posts