ngFor

In Angular, you can use the ngFor directive to generate templates from lists. Essentially, ngFor repeats the template's element it is applied to, along with its subtree, for every item in the bound list.

The basic format with which to use ngFor is shown in the following statement:

let <variableName> of <componentData>

Note that componentData can be either a field, a property, or a function that returns a list.

This makes variableName available to the context of the template associated with ngFor directive. This is the reason you can use c.name to pass it down to the child component as input.

The asterisk you see next to ngFor is often used with structural directives. This a special construct with which Angular provides syntactic sugar ...

Get Hands-On Full-Stack Web Development with ASP.NET Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.