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

Method _sortValues

src/material/select/select.ts:1265–1276  ·  view source on GitHub ↗

Sorts the selected values in the selected based on their order in the panel.

()

Source from the content-addressed store, hash-verified

1263
1264 /** Sorts the selected values in the selected based on their order in the panel. */
1265 private _sortValues() {
1266 if (this.multiple) {
1267 const options = this.options.toArray();
1268
1269 this._selectionModel.sort((a, b) => {
1270 return this.sortComparator
1271 ? this.sortComparator(a, b, options)
1272 : options.indexOf(a) - options.indexOf(b);
1273 });
1274 this.stateChanges.next();
1275 }
1276 }
1277
1278 /** Emits change event to set the model value. */
1279 private _propagateChanges(fallbackValue?: any): void {

Callers 2

_setSelectionByValueMethod · 0.95
_onSelectMethod · 0.95

Calls 2

sortMethod · 0.65
nextMethod · 0.45

Tested by

no test coverage detected