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

Method _assignValue

src/material/select/select.ts:1101–1112  ·  view source on GitHub ↗

Assigns a specific value to the select. Returns whether the value has changed.

(newValue: any | any[])

Source from the content-addressed store, hash-verified

1099
1100 /** Assigns a specific value to the select. Returns whether the value has changed. */
1101 private _assignValue(newValue: any | any[]): boolean {
1102 // Always re-assign an array, because it might have been mutated.
1103 if (newValue !== this._value || (this._multiple && Array.isArray(newValue))) {
1104 if (this.options) {
1105 this._setSelectionByValue(newValue);
1106 }
1107
1108 this._value = newValue;
1109 return true;
1110 }
1111 return false;
1112 }
1113
1114 // `skipPredicate` determines if key manager should avoid putting a given option in the tab
1115 // order. Allow disabled list items to receive focus via keyboard to align with WAI ARIA

Callers 5

valueMethod · 0.95
writeValueMethod · 0.95
_registerModelFunction · 0.80
_onInputFunction · 0.80

Calls 1

_setSelectionByValueMethod · 0.95

Tested by

no test coverage detected