* 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)
| 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. |
no test coverage detected