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

Method ngDoCheck

src/material/select/select.ts:660–693  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

658 }
659
660 ngDoCheck() {
661 const newAriaLabelledby = this._getTriggerAriaLabelledby();
662 const ngControl = this.ngControl;
663
664 // We have to manage setting the `aria-labelledby` ourselves, because part of its value
665 // is computed as a result of a content query which can cause this binding to trigger a
666 // "changed after checked" error.
667 if (newAriaLabelledby !== this._triggerAriaLabelledBy) {
668 const element: HTMLElement = this._elementRef.nativeElement;
669 this._triggerAriaLabelledBy = newAriaLabelledby;
670 if (newAriaLabelledby) {
671 element.setAttribute('aria-labelledby', newAriaLabelledby);
672 } else {
673 element.removeAttribute('aria-labelledby');
674 }
675 }
676
677 if (ngControl) {
678 // The disabled state might go out of sync if the form group is swapped out. See #17860.
679 if (this._previousControl !== ngControl.control) {
680 if (
681 this._previousControl !== undefined &&
682 ngControl.disabled !== null &&
683 ngControl.disabled !== this.disabled
684 ) {
685 this.disabled = ngControl.disabled;
686 }
687
688 this._previousControl = ngControl.control;
689 }
690
691 this.updateErrorState();
692 }
693 }
694
695 ngOnChanges(changes: SimpleChanges<this>) {
696 // Updating the disabled state is handled by the input, but we need to additionally let

Callers

nothing calls this directly

Calls 2

updateErrorStateMethod · 0.95

Tested by

no test coverage detected