Skip to content

fix(core): improve input writes migration in best effort mode#68638

Open
tmpln wants to merge 1 commit into
angular:mainfrom
tmpln:best-effort-write-schematics
Open

fix(core): improve input writes migration in best effort mode#68638
tmpln wants to merge 1 commit into
angular:mainfrom
tmpln:best-effort-write-schematics

Conversation

@tmpln
Copy link
Copy Markdown
Contributor

@tmpln tmpln commented May 8, 2026

Currently, signal migration schematics in best effort mode doesn't do a very good job migrating input writes when there is a nested property access in templates.

In event handlers, no attempt is made to migrate a nested access in the left-hand-side of assignments or anything in their right-hand-side. E.g., nothing will happen here:

(ngModelChange)="inputD.prop = $event + inputF".

Additionally, when a migration attempt is made, parentheses are often incorrectly placed on the parent, both in event handlers and two-way bindings:

(ngModelChange)="inputC = $event" is migrated to (ngModelChange)="inputC = $event()".

[(ngModel)]="inputB.prop.prop" is migrated to [(ngModel)]="inputB.prop().prop".

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

The following line is not updated during migration: (ngModelChange)="inputD.prop = $event + inputF".

This: (ngModelChange)="inputC = $event" is migrated to: (ngModelChange)="inputC = $event()".

This: [(ngModel)]="inputB.prop.prop" is migrated to: [(ngModel)]="inputB.prop().prop".

What is the new behavior?

This: (ngModelChange)="inputD.prop = $event + inputF" is migrated to: (ngModelChange)="inputD().prop = $event + inputF()".

This: (ngModelChange)="inputC = $event" is migrated to: (ngModelChange)="inputC() = $event".

This: [(ngModel)]="inputB.prop.prop" is migrated to: [(ngModel)]="inputB().prop.prop".

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

N/A

Currently, signal migration schematics in best effort mode doesn't do a very good job migrating input writes when there is a nested property access in templates.

In event handlers, no attempt is made to migrate a nested access in the left-hand-side of assignments or anything in their right-hand-side. E.g., nothing will happen here:

`(ngModelChange)="inputD.prop = $event + inputF"`.

Additionally, when a migration attempt is made, parentheses are often incorrectly placed on the parent, both in event handlers and two-way bindings:

`(ngModelChange)="inputC = $event"` is migrated to `(ngModelChange)="inputC = $event()"`.

`[(ngModel)]="inputB.prop.prop"` is migrated to `[(ngModel)]="inputB.prop().prop"`.
@pullapprove pullapprove Bot requested a review from devversion May 8, 2026 12:46
@angular-robot angular-robot Bot added the area: core Issues related to the framework runtime label May 8, 2026
@ngbot ngbot Bot added this to the Backlog milestone May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Issues related to the framework runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant