CheckboxControlValueAccessor
A ControlValueAccessor
for writing a value and listening to changes on a checkbox input element.
NgModules
选择器
input[type=checkbox][formControlName]
input[type=checkbox][formControl]
input[type=checkbox][ngModel]
属性
属性 | 说明 |
---|---|
onChange: (_: any) => { } | The registered callback function called when a change event occurs on the input element. |
onTouched: () => { } | The registered callback function called when a blur event occurs on the input element. |
说明
Using a checkbox with a reactive form.
The following example shows how to use a checkbox with a reactive form.
const rememberLoginControl = new FormControl();
<input type="checkbox" [formControl]="rememberLoginControl">
方法
Sets the "checked" property on the input element. |
Registers a function called when the control value changes. |
Registers a function called when the control is touched. |
Sets the "disabled" property on the input element. |