AngularJS and Cross Domain POST
You're using the $http.post
incorrectly. The second parameter is the data you need to send to server, you cannot set headers like this. In your case, it will send the whole object
as JSON payload
Try this:
$http({
url:'http://my.api.com/Insert',
method:"POST",
headers: {
'Authorization': 'Basic dGVzdDp0ZXN0',
'Content-Type': 'application/x-www-form-urlencoded'
},
data: {
'Code': 'test data'
}
});