I have this $http POST request that works
$http.post('api/saveFile', formData, {
transformRequest: angular.identity,
headers : {
'Content-Type' : undefined
}
}
Meanwhile when I am using $resource instead I am getting a 500 error, basically my backend is seeing a null value from the frontend.
Here is the code for the resource
this.resource = $resource('api/myUrl', {}, {
'saveFile': {
method: 'POST',
url: 'api/myUrl/saveFile',
data: {file : '@file'},
transformRequest: angular.identity,
headers: {'Content-Type': undefined}
}
});
And here is where the resource method is called. Note I tested it so that the code before and after the request is the same
MyService.resource.saveFile(
{file : formData},
function successCallback(response) {
console.log(response);
},
function errorCallback(response) {
console.log(response);
})
So my code here is suppose to upload a file to my backend, then save it to the drive. That works with the $http but not with the $resource