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

MaxValidatorlink

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

A directive which installs the MaxValidator for any formControlName,\nformControl, or control with ngModel that also has a max attribute.

\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()
max: string | number
\n
\n \n

Tracks changes to the max bound to this directive.

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

Descriptionlink

\n \n

Adding a max validatorlink

\n

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

\n\n<input type=\"number\" ngModel max=\"4\">\n\n\n
\n \n\n \n\n \n\n \n\n \n \n \n\n
\n
\n\n\n" }