GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Docs
  • Tutorials
  • Playground
  • Reference
  • code
  • ControlValueAccessor
  • FormControlDirective
  • FormControlName
  • NgModel
  • SelectControlValueAccessor

This view

  • Original page
  • New address

GeezerVison is showing angular.dev — SelectMultipleControlValueAccessor • Angular

API

    
      class SelectMultipleControlValueAccessor extends BuiltInControlValueAccessor implements ControlValueAccessor {}
    
    

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

Description

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

  • ReactiveFormsModule
  • FormsModule

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">
  @for(country of countries; track $index) {
     <option [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.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.