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

Function _registerModel

src/material/datepicker/datepicker-input-base.ts:209–228  ·  view source on GitHub ↗

Registers a date selection model with the input.

(model: MatDateSelectionModel<S, D>)

Source from the content-addressed store, hash-verified

207
208 /** Registers a date selection model with the input. */
209 _registerModel(model: MatDateSelectionModel<S, D>): void {
210 this._model = model;
211 this._valueChangesSubscription.unsubscribe();
212
213 if (this._pendingValue) {
214 this._assignValue(this._pendingValue);
215 }
216
217 this._valueChangesSubscription = this._model.selectionChanged.subscribe(event => {
218 if (this._shouldHandleChangeEvent(event)) {
219 const value = this._getValueFromModel(event.selection);
220 this._lastValueValid = this._isValidValue(value);
221 this._cvaOnChange(value);
222 this._onTouched();
223 this._formatValue(value);
224 this.dateInput.emit(new MatDatepickerInputEvent(this, this._elementRef.nativeElement));
225 this.dateChange.emit(new MatDatepickerInputEvent(this, this._elementRef.nativeElement));
226 }
227 });
228 }
229
230 /** Opens the popup associated with the input. */
231 protected abstract _openPopup(): void;

Callers

nothing calls this directly

Calls 5

_assignValueMethod · 0.80
_onTouchedMethod · 0.80
_formatValueMethod · 0.80
_getValueFromModelMethod · 0.45

Tested by

no test coverage detected