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

Method ngDoCheck

src/material/input/input.ts:384–409  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

382 }
383
384 ngDoCheck() {
385 if (this.ngControl) {
386 // We need to re-evaluate this on every change detection cycle, because there are some
387 // error triggers that we can't subscribe to (e.g. parent form submissions). This means
388 // that whatever logic is in here has to be super lean or we risk destroying the performance.
389 this.updateErrorState();
390
391 // Since the input isn't a `ControlValueAccessor`, we don't have a good way of knowing when
392 // the disabled state has changed. We can't use the `ngControl.statusChanges`, because it
393 // won't fire if the input is disabled with `emitEvents = false`, despite the input becoming
394 // disabled.
395 if (this.ngControl.disabled !== null && this.ngControl.disabled !== this.disabled) {
396 this.disabled = this.ngControl.disabled;
397 this.stateChanges.next();
398 }
399 }
400
401 // We need to dirty-check the native element's value, because there are some cases where
402 // we won't be notified when it changes (e.g. the consumer isn't using forms or they're
403 // updating the value using `emitEvent: false`).
404 this._dirtyCheckNativeValue();
405
406 // We need to dirty-check and set the placeholder attribute ourselves, because whether it's
407 // present or not depends on a query which is prone to "changed after checked" errors.
408 this._dirtyCheckPlaceholder();
409 }
410
411 /** Focuses the input. */
412 focus(options?: FocusOptions): void {

Callers

nothing calls this directly

Calls 4

updateErrorStateMethod · 0.95
nextMethod · 0.45

Tested by

no test coverage detected