jeudi 31 janvier 2019

How to trigger the API with Modal in Angular 6

I need help to know how to trigger a delete API after a modal confirmation in Angular.

onDelete(id: number) {

this.confirmationDialogService.confirm('Confirm Delete', 'Do you really want to delete this document?')
.then(() => this.employeeService.deleteEmployee(id)) //this is not working
//.catch(() => console.log('User dismissed the dialog (e.g., by using ESC, clicking the cross icon, or clicking outside the dialog)'));

/*if (confirm('Are you sure you want delete this record?') == true) {
  this.employeeService.deleteEmployee(id);
}*/

}

As you can see in the code. I need to know how I make the call to the delete API after clicking the OK button in the modal.




Aucun commentaire:

Enregistrer un commentaire