I have the following code in Angular
DepartmentController.prototype.delete = function (id) {
this.departmentResource.delete(id);
};
The error is
DELETE http://localhost:64956//api/departments 405 (Method Not Allowed)
My department factory is :
var Company;
(function (Company) {
function departmentFactory($resource, servicePath) {
return $resource(servicePath + "/api/departments/:serverAction/:id", null, Company.DepartmentResourceActionDescriptors.actions);
}
Company.departmentFactory = departmentFactory;
departmentFactory.$inject = ['$resource', 'servicePath'];
})(Company || (Company = {}));
I put a breakpoint after call delete method from controller and the id looks ok . Can anyone help me please?
You're not passing serverAction, which is required the way you wrote your resource factory.
Use:
in your resource to make it optional. And remove the slash of /api.
B.t.w. what is serverAction for anyway? You might want to remove that(?)