Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

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.

See also

Exported from

Selectors

Properties

Property Description
@Input()
compareWith: (o1: any, o2: any) => boolean
Write-Only

Tracks the option comparison algorithm for tracking identities when checking for changes.

Description

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.