I have a backend implemented with ASP Web API and, in angularjs, i have injected restangular for crud. So, in the angularjs controller i have:
gestionale.controller('mainController', function ($scope, $http, Restangular) {
var basePersonale = Restangular.all('api/Personale');
basePersonale.getList().then(function (personale) {
$scope.myData = personale;
});
....
....
}
At some point in the controller i need to make a PUT request:
var person = $scope.myData[0];
person.put();
The variable "person" is valued correctly but when is executed the put method i see in the Firefox debugger:
Request method: PUT
Request URL: http://127.0.0.1:49375/api/Personale
Status Code: 405 Method not allowed
and the params of the requested is: {"Id":1,"Nome":"Mat"} and is correct.
In effect that method is not allowed because in the web api the put method respond to this url for example:
// PUT api/Personale/5
Why the request url for the PUT method isn't correct?