SelectMultipleControlValueAccessor
The ControlValueAccessor for writing multi-select control values and listening to multi-select
control changes. The value accessor is used by the FormControlDirective, FormControlName, and
NgModel directives.
API
class SelectMultipleControlValueAccessor extends BuiltInControlValueAccessor implements ControlValueAccessor {}
value
anyThe current value.
compareWith
(o1: any, o2: any) => booleanTracks the option comparison algorithm for tracking identities when checking for changes.
writeValue
voidSets the "value" property on one or of more of the select's options.
anyvoidregisterOnChange
voidRegisters a function called when the control value changes and writes an array of the selected options.
(value: any) => anyvoidonChange
(_: any) => voidThe registered callback function called when a change or input event occurs on the input element.
onTouched
() => voidThe registered callback function called when a blur event occurs on the input element.
setProperty
voidHelper method that sets a property on a target element using the current Renderer implementation.
stringanyvoidregisterOnTouched
voidRegisters a function called when the control is touched.
() => voidvoidsetDisabledState
voidSets the "disabled" property on the range input element.
booleanvoidDescription
The ControlValueAccessor for writing multi-select control values and listening to multi-select
control changes. The value accessor is used by the FormControlDirective, FormControlName, and
NgModel directives.
Exported by
Usage Notes
Using a multi-select control
The follow example shows you how to use a multi-select control with a reactive form.
const countryControl = new FormControl();
<select multiple name="countries" [formControl]="countryControl"> <option *ngFor="let country of countries" [ngValue]="country"> {{ country.name }} </option></select>
Customizing option selection
To customize the default option comparison algorithm, <select> supports compareWith input.
See the SelectControlValueAccessor for usage.

