@for

noun

say it: “AT FOR” /æt fɔːr/

Angular template syntax, @for, that repeats a block for every item in a list.

What does @for do?

@for repeats a block of the template for every item in a list. track tells Angular how to recognize each item so it only redraws what changed. @empty shows when the list is empty.

@for (song of playlist; track song.id) {
  <li>{{ song.title }}</li>
} @empty {
  <li>No songs yet</li>
}

In a sentence

  • “@for (product of products; track product.id) draws one card per product.”

Level: Apprentice · More Angular terms at this level

Updated