I'm trying to pass in data that can be used by a DELETE request for my endpoint. I've been able to specify and call the endpoint, but I'm not able to pass in the body for said endpoint. Hence the error. My code consists of the following:
$scope.handleDelete = function (data) {
angular.forEach(data, function (value, key) {
var deleteRequest = [];
var deleteUrl = "api/student/" + value + "/work";
let body = {
"Id": key
}
deleteRequest.push(body);
$log.info(JSON.stringify(deleteRequest))
$http.delete(deleteUrl, {data: deleteRequest});
});
}
My output for the delete request is the following:
[{"id":"3"}]
I'm unsure what I am missing regarding the $http.delete in order to get this function to work. Any help would be appreciate, thanks.