angularjs DELETE FUNCTION 询问客户是否确定删除

angularjs DELETE FUNCTION ask the client if he is sure to delete

嘿,我有一个删除功能适用于 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);
            }
            );
};

任何人都知道我如何询问客户是否确定要删除它。如果他说不,那么不要删除它。 请帮助:)

您可以使用确认功能修改功能如下,您可以在其中输入任何消息,提示用户

$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);
             });
     }
};