I have Tried calling it,but i don't know to pass the actual data is not getting it is reflecting me undefined.what should i do for passing the data from one component to another page modal component.
I have a crud application where i click on the delete button and it should reflect me a modal, in which i want to ensure delete or not ,while clicking on delete it should delete the data specific.
stackblitz.com/edit/angular-orasdfsdfbr4d
while clicking on delete button after confirmation it should delete.and getting error of the undefined id.
When an expected modal is to be opened, you should always check the id or data-target of the button of the delete.
If you're using tables or data table, most likely the ids do not match the modal target.
If it is component issue pls, upload what have you done so far.
UPDATE:
If the id is undefined (based on my experience), you can save the id in a service to be deleted, to save its state. If this is not the problem, then the mapping of your id to be passed has some issues.
Hello @jay shah for delete confirmation, use sweetalert.js . Follow link for documentation : https://sweetalert.js.org/docs/ here is a sample code:
swal({
cancel: {
text: "Delete?",
value: null,
visible: false,
className: "",
closeModal: true,
},
confirm: {
text: "OK",
value: true,
visible: true,
className: "",
closeModal: true
//Action after confirmation here
}
});
To delete a specific data in a loop, use what I call JaPH (Javascript and PHP) such that you execute a javascript code in a php loop; each data on the row should be ID with the ID of that record in the database. That way you won't have ID conflict