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

Method open

src/material/select/select.ts:723–752  ·  view source on GitHub ↗

Opens the overlay panel.

()

Source from the content-addressed store, hash-verified

721
722 /** Opens the overlay panel. */
723 open(): void {
724 if (!this._canOpen()) {
725 return;
726 }
727
728 // It's important that we read this as late as possible, because doing so earlier will
729 // return a different element since it's based on queries in the form field which may
730 // not have run yet. Also this needs to be assigned before we measure the overlay width.
731 if (this._parentFormField) {
732 this._preferredOverlayOrigin = this._parentFormField.getConnectedOverlayOrigin();
733 }
734
735 this._cleanupDetach?.();
736 this._overlayWidth = this._getOverlayWidth(this._preferredOverlayOrigin);
737 this._panelOpen = true;
738 this._overlayDir.positionChange.pipe(take(1)).subscribe(() => {
739 this._changeDetectorRef.detectChanges();
740 this._positioningSettled();
741 });
742 this._overlayDir.attachOverlay();
743 this._keyManager.withHorizontalOrientation(null);
744 this._highlightCorrectOption();
745 this._changeDetectorRef.markForCheck();
746
747 // Required for the MDC form field to pick up when the overlay has been opened.
748 this.stateChanges.next();
749
750 // Simulate the animation event before we moved away from `@angular/animations`.
751 Promise.resolve().then(() => this.openedChange.emit(true));
752 }
753
754 /** Closes the overlay panel and focuses the host element. */
755 close(): void {

Callers 3

toggleMethod · 0.95
_handleClosedKeydownMethod · 0.95
onContainerClickMethod · 0.95

Calls 10

_canOpenMethod · 0.95
_getOverlayWidthMethod · 0.95
_positioningSettledMethod · 0.95
attachOverlayMethod · 0.80
markForCheckMethod · 0.80
resolveMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected