import { Component, TemplateRef } from '@angular/core'; import { NbDialogService } from '@nebular/theme'; import { ShowcaseDialogComponent } from './showcase-dialog/showcase-dialog.component'; import { DialogNamePromptComponent } from './dialog-name-prompt/dialog-name-prompt.component'; @Component({ selector: 'ngx-dialog', templateUrl: 'dialog.component.html', styleUrls: ['dialog.component.scss'], }) export class DialogComponent { names: string[] = []; constructor(private dialogService: NbDialogService) {} open() { this.dialogService.open(ShowcaseDialogComponent, { context: { title: 'This is a title passed to the dialog component', }, }); } open2(dialog: TemplateRef) { this.dialogService.open( dialog, { context: 'this is some additional data passed to dialog' }); } open3() { this.dialogService.open(DialogNamePromptComponent) .onClose.subscribe(name => name && this.names.push(name)); } openWithoutBackdrop(dialog: TemplateRef) { this.dialogService.open( dialog, { context: 'this is some additional data passed to dialog', hasBackdrop: false, }); } openWithoutBackdropClick(dialog: TemplateRef) { this.dialogService.open( dialog, { context: 'this is some additional data passed to dialog', closeOnBackdropClick: false, }); } openWithoutEscClose(dialog: TemplateRef) { this.dialogService.open( dialog, { context: 'this is some additional data passed to dialog', closeOnEsc: false, }); } }