Reputation: 5101
I need to save the data using angular
save method ( 'post'). how can i send the necessary id
is with form data
?
at present i am getting an error as 'Invalid HTTP status code 405`.
here is my controller.js
:
$scope.uploadFile = function ( newFile, id ) {
var data = new FormData();
server.uploadXML.save({
//passing id's
packageId: $scope.packageId,
contractorId : $scope.contractorId,
contractId : id
}, { save: {
//passing data..is it correct?
data: newFile[0]
}});
}
here is my server.js
:
(function () {
"use strict";
angular
.module("tcpApp")
.factory("server", ['$resource', function ($resource) {
var base = 'http://azvsptcsdev02:678/_vti_bin/CPMD.WEBSERVICE/ProjectInfoService.svc/';
return {
uploadXML : $resource( base + 'UploadContract/:packageId/:contractorId/:contractId')
}
}]);
})();
Upvotes: 1
Views: 406
Reputation: 1631
You need to specify which type of request it is.. GET/POST/PUT etc
405 comes when the method is not allowed, which means either the request type is wrong or the endpoint is not defined.
Hope this helps.
Upvotes: 1