fix(angular): align formField control binding with Angular#230
Merged
Brooooooklyn merged 1 commit intomainfrom Apr 15, 2026
Merged
fix(angular): align formField control binding with Angular#230Brooooooklyn merged 1 commit intomainfrom
Brooooooklyn merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f8eae6f96
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
crates/oxc_angular_compiler/src/pipeline/phases/binding_specialization.rs
Show resolved
Hide resolved
Angular's control-directives pipeline treats [formField] as a normal property binding and then inserts separate controlCreate/control instructions. Our Rust pipeline had drifted from that logic and rewrote [formField] into a custom ControlOp carrying the bound value, which emitted legacy output like ɵɵcontrol(ctx.myField, "formField") without ever writing the directive input via ɵɵproperty("formField", ...). In Angular 21 signal forms this leaves FormField.field unset and can surface as NG0950 at runtime.
This change restores the expected control flow for template bindings:
- keep [formField] as a regular PropertyOp
- emit a separate ControlOp after the property update
- reify ControlOp to zero-arg ɵɵcontrol()
- stop extracting duplicate const metadata from ControlOp itself
The tests now cover both the regression and Angular's mixed-order control fixture behavior:
- [formField] must emit ɵɵproperty("formField", ...) plus ɵɵcontrol()
- legacy ɵɵcontrol(value, "formField") output is rejected
- mixed [formField]/[value] bindings preserve update order
- extracted const metadata preserves per-element binding order
Verified with targeted cargo test runs for the new regression, control binding extraction, mixed property ordering, const ordering, pipe slot propagation, and the existing [field] non-control regression.
7f8eae6 to
8d189cf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Angular's control-directives pipeline treats [formField] as a normal property binding and then inserts separate controlCreate/control instructions. Our Rust pipeline had drifted from that logic and rewrote [formField] into a custom ControlOp carrying the bound value, which emitted legacy output like ɵɵcontrol(ctx.myField, "formField") without ever writing the directive input via ɵɵproperty("formField", ...). In Angular 21 signal forms this leaves FormField.field unset and can surface as NG0950 at runtime.
This change restores the expected control flow for template bindings:
The tests now cover both the regression and Angular's mixed-order control fixture behavior:
Verified with targeted cargo test runs for the new regression, control binding extraction, mixed property ordering, const ordering, pipe slot propagation, and the existing [field] non-control regression.
Note
Medium Risk
Changes how
[formField]bindings are specialized, reified, and counted, which can affect generated template update code and directive matching/consts ordering. Scope is limited to control binding pipeline and covered by new integration tests, but regressions would surface at runtime in form control sync.Overview
Aligns
[formField]handling with Angular by emitting it as a normalPropertyOpupdate plus a followingControlOp, instead of rewriting it into a value-carrying control binding.Updates reification so
ControlOpgenerates a zero-argɵɵcontrol()call, stops extracting directive-matching const metadata fromControlOp, and fixes var slot counting soControlOpcontributes0vars (the value is accounted for by the preceding property update).Adds regression tests asserting
ɵɵproperty("formField", ...)+ɵɵcontrol()output, preserving mixed binding order and consts ordering, and ensuring vars counts don’t inflate.Reviewed by Cursor Bugbot for commit 8d189cf. Bugbot is set up for automated code reviews on this repo. Configure here.