From 736c67bc150c5f1fb5a75913b6fc8dcc13a50aae Mon Sep 17 00:00:00 2001 From: Jeremy Elbourn Date: Wed, 14 Aug 2024 14:45:54 -0700 Subject: [PATCH] docs: add small clarification to ng-content (#57408) This expands the recommendation to avoid conditionally showing `` with additional context PR Close #57408 --- adev/src/content/guide/components/content-projection.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/adev/src/content/guide/components/content-projection.md b/adev/src/content/guide/components/content-projection.md index 22d8caffc42..a91950897e1 100644 --- a/adev/src/content/guide/components/content-projection.md +++ b/adev/src/content/guide/components/content-projection.md @@ -66,11 +66,12 @@ template. **The `` element is neither a component nor DOM element**. Instead, it is a special placeholder that tells Angular where to render content. Angular's compiler processes all `` elements at build-time. You cannot insert, remove, or modify `` at -run time. You cannot add **directives**, styles, or -arbitrary attributes to ``. +run time. You cannot add directives, styles, or arbitrary attributes to ``. -You should not conditionally include `` with `ngIf`, `ngFor`, or `ngSwitch`. For -conditional rendering of component content, see [Template fragments](api/core/ng-template). +You should not conditionally include `` with `@if`, `@for`, or `@switch`. Angular always +instantiates and creates DOM nodes for content rendered to a `` placeholder, even if +that `` placeholder is hidden. For conditional rendering of component content, +see [Template fragments](api/core/ng-template). ## Multiple content placeholders