angular/packages/forms
Sonu Kapoor c075ef1173 fix(forms): parse numeric model values for signal forms <select>
When a `<select>` element is bound via `[formField]` to a field with a
`number | null` model, the native DOM always reads `element.value` as a
string. This caused the model to silently receive a string (e.g. `"42"`)
instead of the expected number, and writing `null` to `element.value`
coerced it to the string `"null"` rather than clearing the selection.

Extend `getNativeControlValue` with a `select-one` case that mirrors the
existing `<input type="text">` numeric-model logic: when the current model
type is `number | null`, parse the selected option's string value as a
number, return `null` for an empty selection, and produce a parse error if
the option value is not a valid number.

Extend `setNativeControlValue` with a matching `select-one` case that
converts `null` and `NaN` to `''` (clearing the selection) and writes
numeric values as `String(value)`.

Replace the bare `input.value = ... as string` assignment in the
`observeSelectMutations` callback in `nativeControlCreate` with a call to
`setNativeControlValue` so that option-change re-sync also benefits from
the same null/number handling.

Fixes #68217
2026-04-29 09:11:52 -04:00
..
signals fix(forms): parse numeric model values for signal forms <select> 2026-04-29 09:11:52 -04:00
src docs: add documentation for NG1002 2026-04-10 10:54:41 +03:00
test ci: remove remainings of saucelabs tests 2026-04-22 14:41:03 -07:00
BUILD.bazel build: cleanup workspace deps 2026-04-23 11:38:26 -07:00
index.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
package.json build: cleanup workspace deps 2026-04-23 11:38:26 -07:00
PACKAGE.md build: format md files 2025-11-06 10:03:05 -08:00
public_api.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00