angular-cn/packages/forms/src
Sonu Kapoor 88a235de3a fix(forms): handle numeric values properly in the validator (#36157)
Previously, the behavior of the `minLength` and `maxLength` validators
caused confusion, as they appeared to work with numeric values but
did not in fact produce consistent results. This commit fixes the issue
by skipping validation altogether when a numeric value is used.

BREAKING CHANGES:

* The `minLength` and `maxLength` validators now verify that a value has
numeric `length` property and invoke validation only if that's the case.
Previously, falsey values without the length property (such as `0` or
`false` values) were triggering validation errors. If your code relies on
the old behavior, you can include other validators such as [min][1] or
[requiredTrue][2] to the list of validators for a particular field.

[1]: https://angular.io/api/forms/Validators#min
[2]: https://angular.io/api/forms/Validators#requiredTrue

Closes #35591

PR Close #36157
2020-05-05 11:50:00 -07:00
..
directives docs: update reactive forms page (#35969) 2020-04-07 15:24:17 -07:00
directives.ts refactor(forms): remove ngForm element selector (#33058) 2019-10-11 15:43:56 -07:00
form_builder.ts style(forms): reformat of the `forms` package after clang update (#36466) 2020-04-07 09:47:09 -07:00
form_providers.ts docs: update reactive forms page (#35969) 2020-04-07 15:24:17 -07:00
forms.ts refactor(forms): remove ngForm element selector (#33058) 2019-10-11 15:43:56 -07:00
model.ts docs: update reactive forms page (#35969) 2020-04-07 15:24:17 -07:00
validators.ts fix(forms): handle numeric values properly in the validator (#36157) 2020-05-05 11:50:00 -07:00
version.ts docs: update forms with `@publicApi` tags (#26595) 2018-10-19 14:35:53 -07:00