From 335d8c04dc8824f85004ff01acdcee7a5b3bf48f Mon Sep 17 00:00:00 2001 From: Sam Severance Date: Mon, 4 May 2026 19:29:04 -0400 Subject: [PATCH] docs: clarify @for track expression scope to include properties and methods (cherry picked from commit 2e0ca49f32230a3447472a97cf950a8746ae66e6) --- tools/manual_api_docs/blocks/for.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/manual_api_docs/blocks/for.md b/tools/manual_api_docs/blocks/for.md index 0d69d827d8a..3f84a0fc8e7 100644 --- a/tools/manual_api_docs/blocks/for.md +++ b/tools/manual_api_docs/blocks/for.md @@ -4,9 +4,9 @@ The `@for` block repeatedly renders content of a block for each item in a collec ```angular-html @for (item of items; track item.name) { -
  • {{ item.name }}
  • +
  • {{ item.name }}
  • } @empty { -
  • There are no items.
  • +
  • There are no items.
  • } ``` @@ -35,7 +35,7 @@ For collections that remain static , `track $index` provides a straightforward t collections experiencing additions, deletions, or reordering, opt for a unique property of each item as the tracking key. -Track expressions can only reference `$index`, the item, and fields from the component class. If the `let` segment of the `@for` block introduced an alias for `$index`, that alias may also be referenced. +Track expressions can only reference `$index`, the item, and properties and methods of the component class. If the `let` segment of the `@for` block introduced an alias for `$index`, that alias may also be referenced. ### `$index` and other contextual variables @@ -54,7 +54,7 @@ These variables are always available with these names, but can be aliased via a ```angular-html @for (item of items; track item.id; let idx = $index, e = $even) { -Item #{{ idx }}: {{ item.name }} + Item #{{ idx }}: {{ item.name }} } ```