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

Method _propagateChanges

src/material/select/select.ts:1281–1295  ·  view source on GitHub ↗

Emits change event to set the model value.

(fallbackValue?: any)

Source from the content-addressed store, hash-verified

1279
1280 /** Emits change event to set the model value. */
1281 private _propagateChanges(fallbackValue?: any): void {
1282 let valueToEmit: any;
1283
1284 if (this.multiple) {
1285 valueToEmit = (this.selected as MatOption[]).map(option => option.value);
1286 } else {
1287 valueToEmit = this.selected ? (this.selected as MatOption).value : fallbackValue;
1288 }
1289
1290 this._value = valueToEmit;
1291 this.valueChange.emit(valueToEmit);
1292 this._onChange(valueToEmit);
1293 this.selectionChange.emit(this._getChangeEvent(valueToEmit));
1294 this._changeDetectorRef.markForCheck();
1295 }
1296
1297 /**
1298 * Highlights the selected item. If no option is selected, it will highlight

Callers 1

_onSelectMethod · 0.95

Calls 3

_getChangeEventMethod · 0.95
_onChangeMethod · 0.80
markForCheckMethod · 0.80

Tested by

no test coverage detected