Local change detection is Angular’s signal-aware optimization for OnPush components. When a component uses only signals, a signal update refreshes that component’s UI without triggering change detection in OnPush parent components. It relies on signals reporting their own updates, unlike ordinary component properties that Angular cannot automatically track. section 10.3.4
The mode arrived in Angular v17 after signals made reactive updates observable to Angular. It improves runtime performance by narrowing work to the component whose signal changed, while preserving incremental adoption: convert components over time rather than disrupting application logic. section 10.3.4 section 10.5
Adopt local change detection by moving toward a consistent component model:
- Mark components with the OnPush change-detection strategy. section 10.3.4
- Use signals exclusively within components intended to receive local updates. section 10.3.4
- Migrate iteratively until more of the application uses OnPush and signals. section 10.3.4
- Revisit component inputs as part of the migration, since conventional inputs are simple marked properties while signal inputs support a signal-based component model. section 10.3.4
Signal input driving project data
A project-details component can replace an @Input and ngOnChanges workflow with a required signal input. Converting that input to an observable and switching to the project request produces a signal-backed project value, aligning an input-driven component with the signals-only direction used for local change detection. section 10.3.4
id = input.required({ transform: numberAttribute });
project = toSignal(
toObservable(this.id).pipe(
switchMap(id => this.projectService.getProject(id))
)
);
This implementation turns a required ID input into a signal-driven project lookup, illustrating a practical step away from ngOnChanges and ordinary input properties. section 10.3.4
Local change detection is also a step toward Angular’s zoneless direction. Signals can reduce reliance on Zone.js because they notify Angular about updates directly, although a fully zoneless future remains prospective. section 10.3.4 section 10.5
