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

Function _getPortal

src/material/menu/menu-trigger-base.ts:468–477  ·  view source on GitHub ↗

Gets the portal that should be attached to the overlay.

(menu: MatMenuPanel)

Source from the content-addressed store, hash-verified

466
467 /** Gets the portal that should be attached to the overlay. */
468 private _getPortal(menu: MatMenuPanel): TemplatePortal {
469 // Note that we can avoid this check by keeping the portal on the menu panel.
470 // While it would be cleaner, we'd have to introduce another required method on
471 // `MatMenuPanel`, making it harder to consume.
472 if (!this._portal || this._portal.templateRef !== menu.templateRef) {
473 this._portal = new TemplatePortal(menu.templateRef, this._viewContainerRef);
474 }
475
476 return this._portal;
477 }
478
479 /**
480 * Determines whether the trigger owns a specific menu panel, at the current point in time.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected