import { Component, EventEmitter, Input } from '@angular/core'; import { BsModalRef } from 'ngx-bootstrap/modal'; @Component({ selector: 'app-alert-modal', templateUrl: './alert-modal.component.html', styleUrls: ['./alert-modal.component.css'] }) export class AlertModalComponent { modalRef: BsModalRef; message: string; confirm: boolean; @Input() data: string; @Input() deleteBtn: string; @Input() buttonText: string; //When only single Ok btn is required set this to true @Input() infoPopup: boolean public event: EventEmitter = new EventEmitter(); constructor(public bsModalRef: BsModalRef) {} onConfirm() { this.confirm = true; this.triggerEvent(this.confirm); this.bsModalRef.hide(); } triggerEvent(item: boolean) { this.event.emit(item); } onCancel() { this.bsModalRef.hide(); this.triggerEvent(false); } }