I have a lightweight Angularjs app and I'm trying to process json from my ASP.NET Web Api controller.
In the angularjs factory:
adapter.getLegacyCouriers = function(id) {
return $http({
method: 'GET',
url: 'http://legacywebapi.azurewebsites.net/api/legacycourier'
});
}
In the controller:
legacyService.getLegacyCouriers()
.success(function (response) {
alert("Success: " + JSON.stringify(response));
})
.error(function (response) {
alert("Error: " + JSON.stringify(response));
});
When I exchange the URL in the $http get with this one it hits the success block. However, my default URL which returns json formatted in the same way hits the error block.
Can someone help me? Both returns application/json response headers, and both return a status of 200 OK (using Chrome to debug). I can't figure out why my json is hitting the error block.