Hey i have a delete function works on http:
$scope.RemoveWorker=function(workerid){
$http.delete("/ShiftWeb/rest/admin/removeworker?id="+workerid)
.then(function(response){$scope.removeworker=response.data;
alert("Worker " + workerid + " Deleted");
$state.reload()
console.log(response.data);
}, function(error) {
alert(error.data);
}
);
};
anybody knows how do i ask the client if he sure he wants to delete it or not. if he say no then dont delete it. help please :)
You can modify the function as below using confirm function in which you can enter any message that will prompt user
$scope.RemoveWorker=function(workerid){
if(confirm("Do you really want to delete this record ?")){
$http.delete("/ShiftWeb/rest/admin/removeworker?id="+workerid)
.then(function(response){$scope.removeworker=response.data;
alert("Worker " + workerid + " Deleted");
$state.reload()
console.log(response.data);
}, function(error) {
alert(error.data);
});
}
};