ngFor
- Used to render a list of objects
- ngFor exports a bunch of values like index, first, last, odd, even.
- alias the exported values using local variables. eg index as i
courses = [
{id:1, name: "course1"},
{id:2, name: "course2"},
{id:3, name: "course3"}
]
<ul>
<li *ngFor="let course of courses; index as i; even as isEven">
{{course.name}} {{i}} <span *ngIf="isEven">EVEN</span>
</li>
</ul>