I am currently having an issue with my AngularJS and my .net WebAPI. I can successfully get content or objects through my WebAPI, however I am currently experiencing issues POSTING data.
The errors that I get when trying to post the content is as follows:
OPTIONS http://localhost:18130/api/Products XMLHttpRequest cannot load
http://localhost:18130/api/Products. Response for preflight has invalid HTTP status code 405
Bear in mind that when I try to post using Fiddler it works absolutely fine, no issues whatsoever.
The following is my AngularJS code I am using to post:
var data = { "Title": $scope.title, "Description": $scope.description };
$http.post(
'http://localhost:18130/api/Products',
JSON.stringify(data), {
headers: {
'Content-Type': 'application/json; charset=UTF-8'
}
}).success(function (data) {
console.log(data);
});
Could someone possibly direct me to correct direction? Both WebApi and the AngularJS app are in separate domains, is this a CORS issue? How do I go around to fix when posting.
Thank you in advance.
WebDAVmodule in web.configJSON.stringify(data). I believe Angular takes care of that for you.