...

/

Solution: The Built-in `NgFor` Directive

Solution: The Built-in `NgFor` Directive

Let’s compare the task result with expected result and explanation.

We'll cover the following...

Solution

Here’s an example of what the solution for this task may look like:

<section *ngFor="let user of users; let even = even; let odd = odd; trackBy: trackBy"
         (click)="selectedUser = user"
         [ngClass]="{even: even, odd: odd, active: selectedUser === user}">
  <p>{{user.name}}</p>
  <p>{{user.premium ? 'Premium' : 'Standard' }} account</p>
</section>
The task’s solution
...