← All recipes
Moderne licensed

Find safe navigation in Angular templates

Recipe IDorg.openrewrite.angular.search.find-template-safe-navigationArtifact@openrewrite/recipes-angular

Finds ?. in HTML templates and in inline template metadata. Angular 22 changed safe navigation in templates to return undefined instead of null, which changes bindings that tell the two apart. Angular ships a $safeNavigationMigration() wrapper for this; this recipe reports the templates to review rather than rewriting the expressions.

Composite 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.search.find-template-safe-navigation

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

mod config recipes npm install @openrewrite/recipes-angular

Definition

This recipe runs the following recipes in order.

  • Find safe navigation in HTML templatesorg.openrewrite.angular.search.find-template-safe-navigation.html
  • Find safe navigation in inline templatesorg.openrewrite.angular.search.find-template-safe-navigation.inline