ngAfterViewInit() { this._portal = new TemplatePortal(this._dialogTemplate, this._viewContainerRef); this._overlayRef = this._overlay.create({ positionStrategy: this._overlay.position().global().centerHorizontally().centerVertically(), hasBackdrop: true }); this._overlayRef.backdropClick().subscribe(() => this._overlayRef.detach()); }
// Create component to ApplicationRef private createModal(): void { this.overlayRef = this.overlay.create(); this.modalRef = this.overlayRef.attach(new ComponentPortal(NzModalComponent)); }
destroyModal(): void { if (this.modalRef) { this.overlayRef.dispose(); this.modalRef = null; } }
close() { this.overlayRef.dispose(); }
close(): void { this.overlayRef.dispose(); }
openDialog() { this._overlayRef.attach(this._portal); }
ngOnDestroy() { this._overlayRef.dispose(); }