The Wayback Machine - https://web.archive.org/web/20250915163921/https://angular.dev/api/forms/CheckboxRequiredValidator
    • Overview
@angular/forms

CheckboxRequiredValidator

directive
stable

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.

API

    
      class CheckboxRequiredValidator extends RequiredValidator {}
    
    

required

string | boolean

Tracks changes to the required attribute bound to this directive.

Description

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.


Exported by

Usage Notes

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>
Jump to details
HTTPS · web.archive.org
← Home