MCPcopy
hub / github.com/angular/components / _setSelection

Method _setSelection

src/cdk/collections/selection-model.ts:179–190  ·  view source on GitHub ↗

Sets the current selection from an array of items.

(values: T[])

Source from the content-addressed store, hash-verified

177
178 /** Sets the current selection from an array of items. */
179 private _setSelection(values: T[]) {
180 this._verifyValueAssignment(values);
181 const oldValues = this.selected;
182 const newSelectedSet = new Set(values.map(value => this._getConcreteValue(value)));
183 values.forEach(value => this._markSelected(value));
184 oldValues
185 .filter(value => !newSelectedSet.has(this._getConcreteValue(value, newSelectedSet)))
186 .forEach(value => this._unmarkSelected(value));
187 const changed = this._hasQueuedChanges();
188 this._emitChangeEvent();
189 return changed;
190 }
191
192 /** Emits a change event and clears the records of selected and deselected values. */
193 private _emitChangeEvent() {

Callers 2

SelectionModelClass · 0.95
setSelectionMethod · 0.95

Calls 7

_getConcreteValueMethod · 0.95
_markSelectedMethod · 0.95
_unmarkSelectedMethod · 0.95
_hasQueuedChangesMethod · 0.95
_emitChangeEventMethod · 0.95
filterMethod · 0.45

Tested by

no test coverage detected