mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
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
This commit is contained in:
parent
391f833cc0
commit
c737eeedbe
1 changed files with 1 additions and 0 deletions
|
|
@ -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`
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue