I am implementing REST service using Spring. When i call delete function the request doesn't reach controller and from JS i receive error: angular.js:12587 DELETE http://localhost:8080/Guard_Server/restapi/sites?siteId=5 500 (Internal Server Error)
my controller function looks like:
@RequestMapping(value="sites", method=RequestMethod.DELETE)
boolean deleteSite(@PathVariable("siteId") int site_id, HttpServletResponse res){
.......
}
And AngularJS function is:
$scope.deleteSite=function(){
if(confirm("Are you sure you want to delete this Site?")){
var site={};
site.siteId=sites[$scope.selectedSite].id;
console.log(site);
siteFactory.delete(site).$promise.then(function(result){
...
}
,error_on_execute);
}
}
with factory:
serverApp.factory('referentFactory',['$resource',function ($resource){
return $resource("http://localhost:8080/Guard_Server/restapi/referents",null,{ 'update': {method: 'PUT'} });
}]);