我正在尝试使用ngbmodal创建通用确认框,它将在整个应用程序中使用.其中,标题和消息将从调用组件传递给模态.我创建了一个DialogService并添加到entryComponents中.现在我可以显示确认框.但是无法得到结果.下面是显示ConfirmationBox组件的代码.如何从中获取价值
const modalRef = this.modalService.open(ConfirmationBoxComponent,{backdrop:"static"})
modalRef.componentInstance.name = "Message";
modalRef.componentInstance.confirmationBoxTitle = "Confirmation?"
modalRef.componentInstance.confirmationmessage = "Do you want to cancel?"
modalRef.componentInstance.changeRef.markForCheck();
Run Code Online (Sandbox Code Playgroud)