ChangeDetectionStrategy.OnPush

Opts a component into push-based change detection for performance.

Since Angular 2+ Spec ↗

Syntax

changeDetection: ChangeDetectionStrategy.OnPush

Returns

component config — Limits checks to specific triggers.

Examples

import { Component, ChangeDetectionStrategy, signal } from '@angular/core';

@Component({
  selector: 'app-x',
  standalone: true,
  changeDetection: ChangeDetectionStrategy.OnPush,
  template: `<p>{{ count() }}</p>`,
})
export class XComponent {
  count = signal(0);
}

Notes

With OnPush, Angular checks the component only when an input reference changes, an event fires in it, an async pipe emits, or a read signal updates. Pairs naturally with signals and immutable data; avoid in-place mutation. Recommended default for new components.