Update the internal value of the listbox based on the selection model.
()
| 922 | |
| 923 | /** Update the internal value of the listbox based on the selection model. */ |
| 924 | private _updateInternalValue() { |
| 925 | const indexCache = new Map<T, number>(); |
| 926 | this.selectionModel.sort((a: T, b: T) => { |
| 927 | const aIndex = this._getIndexForValue(indexCache, a); |
| 928 | const bIndex = this._getIndexForValue(indexCache, b); |
| 929 | return aIndex - bIndex; |
| 930 | }); |
| 931 | const selected = this.selectionModel.selected; |
| 932 | this._invalid = |
| 933 | (!this.multiple && selected.length > 1) || !!this._getInvalidOptionValues(selected).length; |
| 934 | this.changeDetectorRef.markForCheck(); |
| 935 | } |
| 936 | |
| 937 | /** |
| 938 | * Gets the index of the given value in the given list of options. |
no test coverage detected