NG Kit

Disabled options

Prevents selection of specific options via getOptionDisabled — here every third film is disabled. Disabled options are shown greyed out and skipped during keyboard navigation.

Usage

Import AutocompleteComponent and configure it with the inputs below. The full runnable source is on the Examples tab.

html
<autocomplete
  [options]="films"
  [(value)]="value"
  [getOptionDisabled]="isEveryThird"
  appearance="outline"
  label="Movie" />

API

This example demonstrates the inputs below. See the Autocomplete introduction for the complete API — every input, output, content template and filter helper.

Inputs

NameTypeDefaultDescription
optionsreadonly T[]— (required)The list of options shown in the panel.
valueT | T[] | nullnullTwo-way selected value (model). An array when multiple.
getOptionDisabled(option: T) => boolean() => falseMarks individual options as disabled.
labelstring | nullnullField label (mat-label).