I'm trying to delete data by it's id, but it's not working. When I set the id of the data i want to delete, it works. I need your help.
My HTML code:
<div data-ng-controller="deletePinCtrl">
<button data-ng-click="deletePin()">delete</button>
</div>
<h3>{{pin.title}}</h3>
<h4>{{pin.content}}</h4>
My Angular code:
.controller("deletePinCtrl", function($scope, $http){
$scope.deletePin = function() {
var obj = { "id": "value"};
var config = { data: JSON.stringify(obj) };
$http.delete('http://localhost:8080/SpringMVCHibernate/rest/delete', config).
then(function(response) {
alert("pin is deleted");
}, function(response) {
alert("try again");
});
}
})