CheckboxControlValueAccessor
A ControlValueAccessor
for writing a value and listening to changes on a checkbox input
element.
API
class CheckboxControlValueAccessor extends BuiltInControlValueAccessor implements ControlValueAccessor {}
writeValue
void
Sets the "checked" property on the input element.
any
void
onChange
(_: any) => void
The registered callback function called when a change or input event occurs on the input element.
onTouched
() => void
The registered callback function called when a blur event occurs on the input element.
setProperty
void
Helper method that sets a property on a target element using the current Renderer implementation.
string
any
void
registerOnTouched
void
Registers a function called when the control is touched.
() => void
void
registerOnChange
void
Registers a function called when the control value changes.
(_: any) => {}
void
setDisabledState
void
Sets the "disabled" property on the range input element.
boolean
void
Description
A ControlValueAccessor
for writing a value and listening to changes on a checkbox input
element.
Exported by
Usage Notes
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">