{ "id": "api/forms/MinLengthValidator", "title": "MinLengthValidator", "contents": "\n\n
\n
\n
\n \n API > @angular/forms\n
\n \n
\n \n
\n

MinLengthValidatorlink

\n \n \n \n \n \n
\n \n \n\n
\n \n
\n

A directive that adds minimum length validation to controls marked with the\nminlength attribute. The directive is provided with the NG_VALIDATORS multi-provider list.

\n\n \n
\n \n \n \n \n
\n

See alsolink

\n \n
\n\n\n

NgModuleslink

\n\n\n\n \n
\n

Selectorslink

\n \n \n \n
\n\n\n\n \n\n
\n

Propertieslink

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
PropertyDescription
\n \n @Input()
minlength: string | number
\n
\n \n

Tracks changes to the minimum length bound to this directive.

\n\n \n
\n
\n\n\n\n \n\n\n \n
\n

Descriptionlink

\n \n

Adding a minimum length validatorlink

\n

The following example shows how to add a minimum length validator to an input attached to an\nngModel binding.

\n\n<input name=\"firstName\" ngModel minlength=\"4\">\n\n\n
\n \n\n \n\n \n\n \n\n \n \n \n\n
\n
\n\n\n" }