Is there a way to implement a confirmation dialog box for the delete button in angularjs?
<button class="btn btn-sm btn-danger" ng-click="removeUser($index)">Delete</button>
Here's an example of how you can achieve this.
<span><a class="button" onclick="return confirm('Are you sure to delete this record ?')" href="delete/{{ item.id }}">Delete</span>
Update
This is my current approach:
function removeUser(index) {
var isConfirmed = confirm("Are you sure to delete this record ?");
if(isConfirmed){
vm.users.splice(index, 1);
}else{
return false;
}
};