← All recipes
Moderne licensed

Add ChangeDetectionStrategy.Eager to components

Recipe IDorg.openrewrite.angular.migration.add-eager-change-detectionArtifact@openrewrite/recipes-angular

Adds changeDetection: ChangeDetectionStrategy.Eager to @Component decorators that do not specify a change detection strategy. Angular 22 changed the default for such components to ChangeDetectionStrategy.OnPush; making the previous check-always behavior explicit keeps them working unchanged.

Single recipeProprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.angular.migration.add-eager-change-detection

If the recipe isn’t available locally, install it with:

mod config recipes npm install @openrewrite/recipes-angular