docs(forms): clarify the description of `minLength` and `maxLength` (#36297)

Previously, it was not clear that the `minLength` and `maxLength` validators
can only be used with objects that contain a `length` property. This commit
clarifies this.

PR Close #36297
This commit is contained in:
Sonu Kapoor 2020-03-28 09:59:40 -04:00 committed by atscott
parent 80e6c07d89
commit 99b93e55cb
1 changed files with 7 additions and 2 deletions

View File

@ -267,7 +267,11 @@ export class Validators {
* @description
* Validator that requires the length of the control's value to be greater than or equal
* to the provided minimum length. This validator is also provided by default if you use the
* the HTML5 `minlength` attribute.
* the HTML5 `minlength` attribute. Note that the `minLength` validator is intended to be used
* only for types that have a numeric `length` property, such as strings or arrays. The `minLength`
* validator logic is also not invoked for values when their `length` property is 0 (for example in
* case of an empty string or an empty array), to support optional controls. You can use
* the standard `required` validator if empty values should not be considered valid.
*
* @usageNotes
*
@ -305,7 +309,8 @@ export class Validators {
* @description
* Validator that requires the length of the control's value to be less than or equal
* to the provided maximum length. This validator is also provided by default if you use the
* the HTML5 `maxlength` attribute.
* the HTML5 `maxlength` attribute. Note that the `maxLength` validator is intended to be used
* only for types that have a numeric `length` property, such as strings or arrays.
*
* @usageNotes
*