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

Method _attachHost

src/cdk/overlay/overlay-ref.ts:456–479  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

454 }
455
456 private _attachHost() {
457 if (!this._host.parentElement) {
458 const customInsertionPoint = this._config.usePopover
459 ? this._positionStrategy?.getPopoverInsertionPoint?.()
460 : null;
461
462 if (isElement(customInsertionPoint)) {
463 customInsertionPoint.after(this._host);
464 } else if (customInsertionPoint?.type === 'parent') {
465 customInsertionPoint.element.appendChild(this._host);
466 } else {
467 this._previousHostParent?.appendChild(this._host);
468 }
469 }
470
471 if (this._config.usePopover) {
472 // We need the try/catch because the browser will throw if the
473 // host or any of the parents are outside the DOM. Also note
474 // the string access which is there for compatibility with Closure.
475 try {
476 this._host['showPopover']();
477 } catch {}
478 }
479 }
480
481 /** Attaches a backdrop for this overlay. */
482 private _attachBackdrop() {

Callers 1

attachMethod · 0.95

Calls 2

isElementFunction · 0.85

Tested by

no test coverage detected