Force AngularJS $http.post to return JSON



Coming from jQuery, setting the content-type to application/json would give me a json object instead of an xml-formatted string.


How can I achieve the same using AngularJS $http.post?


Tried doing



$http({
method: "post",
url: "url",
headers: { "Content-Type": "application/json; charset=utf-8" }
})


but the parameter in success is an xml-formatted string.


No comments:

Post a Comment