license import { DOCUMENT } from '@angular/common' ; import { Inject , Injectable , InjectionToken , OnDestroy , Optional , SkipSelf , } from '@angular/core' ; /** Container inside which all overlays will render. */ @ Injectable ( { providedIn : 'root' } ) export class OverlayContainer implements OnDestroy { protected _containerElement : HTMLElement ; constructor ( @ Inject ( DOCUMENT ) protected _document ) { } ngOnDestroy ( ) { if ( this . _containerElement && this . _containerElement . parentNode ) { this . _containerElement . parentNode . removeChild ( this . _containerElement ) ; } } returns getContainerElement ( ) { if ( ! this . _containerElement ) { this . _createContainer ( ) ; } return this . _containerElement ; } /**
     * Create the overlay container element, which is simply a div
     * with the 'cdk-overlay-container' class on the document body.
     */ protected _createContainer ( ) { const container = this . _document . createElement ( 'div' ) ; container . classList . add ( 'cdk-overlay-container' ) ; this . _document . body . appendChild ( container ) ; this . _containerElement = container ; } } docs-private deprecated breaking-change export function OVERLAY_CONTAINER_PROVIDER_FACTORY ( parentContainer , _document ) { return parentContainer || new OverlayContainer ( _document ) ; } docs-private deprecated breaking-change export const OVERLAY_CONTAINER_PROVIDER = { provide : OverlayContainer , deps : [ [ new Optional ( ) , new SkipSelf ( ) , OverlayContainer ] , DOCUMENT as InjectionToken < any > ] , useFactory : OVERLAY_CONTAINER_PROVIDER_FACTORY } ;