Exercise: The Built-in `NgFor` Directive
Let’s practice working with the `NgFor` directive.
We'll cover the following
Objectives
In this task, we’ll display users like we did in the previous lesson using NgIf
. However, this time the users will be stored in the array. We need to display the users in the form of a list while meeting these requirements:
- The users have to be displayed using the
NgFor
directive. - The user should be able to highlight any list item by clicking it.
- The users should be displayed in a clear way. The odd and even rows of data should have different backgrounds, for example,
light-grey
anddark-grey
colors. - We should use the
trackBy
function to improve the performance of theNgFor
directive.
Task
Please write the code below:
Get hands-on with 1400+ tech skills courses.