MCPcopy Create free account
hub / github.com/angular/components / _sortValues

Method _sortValues

src/material/select/select.ts:1267–1278  ·  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

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