MCPcopy Index your code
hub / github.com/angular/components / triggerOption

Method triggerOption

src/cdk/listbox/listbox.ts:638–653  ·  view source on GitHub ↗

* Triggers the given option in response to user interaction. * - In single selection mode: selects the option and deselects any other selected option. * - In multi selection mode: toggles the selected state of the option. * @param option The option to trigger

(option: CdkOption<T> | null)

Source from the content-addressed store, hash-verified

636 * @param option The option to trigger
637 */
638 protected triggerOption(option: CdkOption<T> | null) {
639 if (option && !option.disabled) {
640 this._lastTriggered = option;
641 const changed = this.multiple
642 ? this.selectionModel.toggle(option.value)
643 : this.selectionModel.select(option.value);
644 if (changed) {
645 this._onChange(this.value);
646 this.valueChange.next({
647 value: this.value,
648 listbox: this,
649 option: option,
650 });
651 }
652 }
653 }
654
655 /**
656 * Trigger the given range of options in response to user interaction.

Callers 2

_handleKeydownMethod · 0.95
_handleOptionClickedMethod · 0.95

Calls 4

_onChangeMethod · 0.80
toggleMethod · 0.65
selectMethod · 0.65
nextMethod · 0.45

Tested by

no test coverage detected