docs: clarify OnPush (#46314)

PR Close #46314
This commit is contained in:
Younes Jaaidi
2022-06-09 04:47:29 +02:00
committed by Jessica Janiuk
parent d6ee9f29e6
commit 074075d551
@@ -11,7 +11,7 @@ If you are confident that a part of the application is not affected by a state c
OnPush change detection instructs Angular that to only run change detection automatically for a component subtree when: OnPush change detection instructs Angular that to only run change detection automatically for a component subtree when:
* The root component of the subtree receives new inputs as the result of a template binding. Angular compares the current and past value of the input with `==` * The root component of the subtree receives new inputs as the result of a template binding. Angular compares the current and past value of the input with `==`
* Angular handles an event within the component with OnPush change detection * Angular handles an event _(e.g. using event binding, output binding, or `@HostListener`)_ in the subtree's root component or any of its children wether they are using OnPush change detection or not.
You can set the change detection strategy of a component to `OnPush` in the `@Component` decorator: You can set the change detection strategy of a component to `OnPush` in the `@Component` decorator: