import { Injectable } from '@angular/core' ; import { Observable } from 'rxjs' ; import { NgbModal } from '@ng-bootstrap/ng-bootstrap' ; import { ConfirmDialogComponent } from './confirm-dialog.component' ; @ Injectable ( ) export class ConfirmDialogService { constructor ( private modalService ) { } public confirm ( title , message , btnOkText = 'OK' , btnCancelText = 'Cancel' , dialogSize = 'sm' ) { const modalRef = this . modalService . open ( ConfirmDialogComponent , { size : dialogSize } ) ; modalRef . componentInstance . title = title ; modalRef . componentInstance . message = message ; modalRef . componentInstance . btnOkText = btnOkText ; modalRef . componentInstance . btnCancelText = btnCancelText ; return modalRef . result ; } }