I am using ngx-bootstrap modal, but I want to use something like this
confirmDialog(message: string, note: string, onOk, onCancel) {
// modal open
// on click onOk button some action perform
// on click onCancel button some action perform
}
So that I can use this method wherever I want to perform both action. Is this possible?
I am using ngx-bootstrap modal for a delete modal. To get it working you will need to use @Input and @Output to pass the refinances to and from the parent. The example below could easily be modified to fill your needs. If you are needing to pass a value from the child to the parent you can do that in the Event Emitter by changing the type to something like
EventEmitter< any >
and on the on the template change it to(deleteEvent)="delete($event)"
the on the emit pass the value you want to send in the eventthis.deleteEvent.emit(true);
.My Delete Modal ts
My Delete Modal HTML
On the Component that I want to display the dialog