From c38ea0767e507106bfb2b23bca538bc2ebc663e6 Mon Sep 17 00:00:00 2001 From: Jeremy Elbourn Date: Wed, 15 Jan 2025 08:23:12 -0800 Subject: [PATCH] docs: clarify that `@for` doesn't support break/continue (#59533) We recently saw some confusion around this, so it's worth adding a sentence to clarify PR Close #59533 --- adev/src/content/guide/templates/control-flow.md | 2 ++ tools/manual_api_docs/blocks/for.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/adev/src/content/guide/templates/control-flow.md b/adev/src/content/guide/templates/control-flow.md index 861d9247abc..735b8a31a64 100644 --- a/adev/src/content/guide/templates/control-flow.md +++ b/adev/src/content/guide/templates/control-flow.md @@ -50,6 +50,8 @@ A typical `@for` loop looks like: } ``` +Angular's `@for` block does not support flow-modifying statements like JavaScript's `continue` or `break`. + ### Why is `track` in `@for` blocks important? The `track` expression allows Angular to maintain a relationship between your data and the DOM nodes on the page. This allows Angular to optimize performance by executing the minimum necessary DOM operations when the data changes. diff --git a/tools/manual_api_docs/blocks/for.md b/tools/manual_api_docs/blocks/for.md index 2ad9fa9c656..f3520567ff7 100644 --- a/tools/manual_api_docs/blocks/for.md +++ b/tools/manual_api_docs/blocks/for.md @@ -19,6 +19,8 @@ but there are performance advantages of using a regular `Array`. You can optionally include an `@empty` section immediately after the `@for` block content. The content of the `@empty` block displays when there are no items. +Angular's `@for` block does not support flow-modifying statements like JavaScript's `continue` or `break`. + ### `track` and objects identity The value of the `track` expression determines a key used to associate array items with the views in