Find safe navigation in Angular templates
Recipe ID
org.openrewrite.angular.search.find-template-safe-navigationArtifact@openrewrite/recipes-angularFinds ?. 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-navigationIf the recipe isn’t available locally, install it with:
mod config recipes npm install @openrewrite/recipes-angularDefinition
This recipe runs the following recipes in order.
- Find safe navigation in HTML templates
org.openrewrite.angular.search.find-template-safe-navigation.html - Find safe navigation in inline templates
org.openrewrite.angular.search.find-template-safe-navigation.inline