OnPush Change Detection
Introduction
Section titled “Introduction”OnPush reduces the number of change detection cycles by only checking components when specific conditions are met.
When OnPush Triggers
Section titled “When OnPush Triggers”- @Input reference changes
- Event originates inside component
- async pipe emits new value
- markForCheck() called manually
Example
Section titled “Example”@Component({ changeDetection: ChangeDetectionStrategy.OnPush})export class ProductCardComponent { @Input() product: Product;}Summary
Section titled “Summary”OnPush is the standard strategy for production Angular apps.”