• 개요
@angular/forms

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.

API

    
      class CheckboxRequiredValidator extends RequiredValidator {}
    
    

required

string | boolean

Tracks changes to the required attribute bound to this directive.

설명

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.

다음 모듈에서 내보냄

사용 시 참고사항

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>
상세 내용으로 이동