import { Component, OnInit, Input, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core'; @Component({ selector: 'cbms-dialog-lib', templateUrl: './dialog.component.html', styleUrls: ['./dialog.component.scss'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Eager, standalone: false }) export class DialogComponent { public opened: boolean = false; public successFunction:any=null; public isAlert:boolean; public failureFunction:any=null; public message:string; @Input('title') title: string = ''; public close(status) { this.opened = false; } public open() { this.opened = true; } showAlert(message:string,successFunc){ this.message=message; this.title="Alert"; this.successFunction=successFunc; this.isAlert=true; this.opened = true; } showConfirm(message:string,successFunc,failureFunc){ this.message=message; this.title="Confirm"; this.successFunction=successFunc; this.failureFunction=failureFunc; this.isAlert=false; this.opened = true; } closeDialog(status) { this.opened = false; if(status=='yes' && this.successFunction ){ this.successFunction(); } if(status=='no' && this.failureFunction ){ this.failureFunction(); } } }