Angular · Junior · Question 55 of 75
Which variables are available inside an @for block?
@for (item of items; track item.id; let i = $index, last = $last) {
<li>{{ i + 1 }}. {{ item.name }} @if (!last) { , }</li>
}- ✓Correct answer: Contextual variables like
$index,$first,$last,$even,$oddand$count - 2Only
$index - 3None - you must compute the index yourself
Explanation
They can be used directly or aliased with let. Aliases help in nested loops where the inner $index would shadow the outer one.