From c737eeedbed07404e491184a461cf864d656d1dd Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Thu, 23 Jan 2025 14:09:56 -0800 Subject: [PATCH] docs(core): Clarify what it means to be a host for user components (#59689) Adds a note to clarify what it means for a component to host a user component in the context of `OnPush` restrictions. fixes #58648 PR Close #59689 --- adev/src/content/guide/zoneless.md | 1 + 1 file changed, 1 insertion(+) diff --git a/adev/src/content/guide/zoneless.md b/adev/src/content/guide/zoneless.md index 5577b2339bb..fa5d756e248 100644 --- a/adev/src/content/guide/zoneless.md +++ b/adev/src/content/guide/zoneless.md @@ -60,6 +60,7 @@ use [ChangeDetectionStrategy.OnPush](/best-practices/skipping-subtrees#using-onp The `OnPush` change detection strategy is not required, but it is a recommended step towards zoneless compatibility for application components. It is not always possible for library components to use `ChangeDetectionStrategy.OnPush`. When a library component is a host for user-components which might use `ChangeDetectionStrategy.Default`, it cannot use `OnPush` because that would prevent the child component from being refreshed if it is not `OnPush` compatible and relies on ZoneJS to trigger change detection. Components can use the `Default` strategy as long as they notify Angular when change detection needs to run (calling `markForCheck`, using signals, `AsyncPipe`, etc.). +Being a host for a user component means using an API such as `ViewContainerRef.createComponent` and not just hosting a portion of a template from a user component (i.e. content projection or a using a template ref input). ### Remove `NgZone.onMicrotaskEmpty`, `NgZone.onUnstable`, `NgZone.isStable`, or `NgZone.onStable`