Angular · Junior · Question 19 of 75

What is required in an @for block?

@for (item of items; track item.id) {
  <li>{{ item.name }}</li>
}

Explanation

track tells Angular how to match items between renders so it can reuse DOM nodes instead of recreating them. Use a stable id; track $index is acceptable only for static lists.

Further reading

Problem with a question

Angular · Junior · question 19

Test yourself

Take the Angular · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz