Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

CheckboxRequiredValidator

A Directive that adds the required validator to checkbox controls marked with the required attribute. The directive is provided with the NG_VALIDATORS multi-provider list.

See also

Exported from

Selectors

  • input[type=checkbox][required][formControlName]
  • input[type=checkbox][required][formControl]
  • input[type=checkbox][required][ngModel]

Inherited from RequiredValidator

Description

Adding a required checkbox validator using template-driven forms

The following example shows how to add a checkbox required validator to an input attached to an ngModel binding.

      
      <input type="checkbox" name="active" ngModel required>