feat(forms): support binding null to number input by mmalerba · Pull Request #66917 · angular/angular
mmalerba
changed the title
fix(forms): simplify design of parse errors
feat(forms): support binding null to number input
mmalerba
marked this pull request as ready for review
Changes `parsedErrors` to a `linkedSignal` based on the model value. This ensures that the parse errors are reset if the model changes from outside the control.
Integrates native inputs with the new parseErrors API so that they can report parse errors when the user types an un-parsable value (e.g. "42e" in a number field). When a user types an un-parsable value, the model does not update. It retains its previous value and a parse error is added for the control that received the un-parsable value.
Supports binding `null` to a `<input type=number>`. - Binding in `null` clears the input - Binding in `NaN` also clears the input - When the user clears the input, the model is set to `null` - The model is _never_ set to `NaN` based on user interaction. It is either set to `null` if the user cleared the input, or is unchanged and a parse error added if the user entered an invalid number like "42e"
native controls and custom controls (via transformedValue) use similar parsing logic but it needs to be hooked up differently. This commit extracts the common bits into a shared piece.
mattrbeck pushed a commit that referenced this pull request
Feb 13, 2026Integrates native inputs with the new parseErrors API so that they can report parse errors when the user types an un-parsable value (e.g. "42e" in a number field). When a user types an un-parsable value, the model does not update. It retains its previous value and a parse error is added for the control that received the un-parsable value. PR Close #66917
mattrbeck pushed a commit that referenced this pull request
Feb 13, 2026Supports binding `null` to a `<input type=number>`. - Binding in `null` clears the input - Binding in `NaN` also clears the input - When the user clears the input, the model is set to `null` - The model is _never_ set to `NaN` based on user interaction. It is either set to `null` if the user cleared the input, or is unchanged and a parse error added if the user entered an invalid number like "42e" PR Close #66917
mattrbeck pushed a commit that referenced this pull request
Feb 13, 2026native controls and custom controls (via transformedValue) use similar parsing logic but it needs to be hooked up differently. This commit extracts the common bits into a shared piece. PR Close #66917
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