0Pricing
Angular Academy · Lesson

OnPush Change Detection

Reduce checks with OnPush strategy.

The Performance Problem

The default strategy checks every component on every tick. In large apps this adds up. OnPush tells Angular to skip a component unless something relevant changed.

Enabling OnPush

Set the changeDetection option on the component.

@Component({
  selector: 'app-user',
  changeDetection: ChangeDetectionStrategy.OnPush,
  template: '{{ user().name }}'
})
export class UserComponent {}

All lessons in this course

  1. How Change Detection Works
  2. OnPush Change Detection
  3. Zoneless Angular
  4. Optimizing Lists and Rendering
← Back to Angular Academy