This is the archived documentation for Angular v6. Please visit angular.io to see documentation for the current version of Angular.

CheckboxRequiredValidator

A Directive that adds the required validator to checkbox controls marked with the required attribute, via the NG_VALIDATORS binding.

NgModules

Selectors

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

Inherited from RequiredValidator

Description

Example

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

Methods

validate(control: AbstractControl): ValidationErrors | null
      
      validate(control: AbstractControl): ValidationErrors | null
    

Parameters

control

Type: AbstractControl.

Returns

ValidationErrors | null

Inherited from RequiredValidator