API: Core
OverlayService
Service reference for OverlayService.
Overview
- Kind: Service
- Provided in:
root - Source: packages/core/src/overlay/overlay.service.ts:11
Public methods
create
create(templateRef: TemplateRef<unknown>, viewContainerRef: ViewContainerRef, anchor: OverlayAnchor, config?: Partial<OverlayConfig>): OverlayRef
Creates an OverlayRef for a given anchor element or virtual coordinate anchor and template. Call .open() / .close() / .toggle() on the returned ref.
Safe to call during SSR: the overlay is not attached to the DOM until the browser environment is available.
| Parameter | Type | Optional | Description |
|---|---|---|---|
templateRef |
TemplateRef<unknown> |
||
viewContainerRef |
ViewContainerRef |
||
anchor |
OverlayAnchor |
||
config |
Partial<OverlayConfig> |
Yes |
createAt
createAt(templateRef: TemplateRef<unknown>, viewContainerRef: ViewContainerRef, anchor: OverlayVirtualAnchor, config?: Partial<OverlayConfig>): OverlayRef
Convenience helper for context menus and pointer-driven popovers. Coordinates are viewport-relative, matching MouseEvent.clientX/clientY.
| Parameter | Type | Optional | Description |
|---|---|---|---|
templateRef |
TemplateRef<unknown> |
||
viewContainerRef |
ViewContainerRef |
||
anchor |
OverlayVirtualAnchor |
||
config |
Partial<OverlayConfig> |
Yes |