I have a REST API in GO language and the front-end in Angularjs , but when I get my resource in angular my custom header don't exist.
Controller:
Persons.query(
function (data, headerGetter, status) {
var headers = headerGetter();
console.log(headers["X-Total-Count"]); //PRINT: undefined
console.log(headers) //PRINT: {Content-Type:application/json;charset=utf-8}
console.log(data); //PRINT: [{name:'mr x', age:'67'}, ....]
},
function (error) {
console.error(error);
});
Model:
myApp.factory("Persons", function ($resource) {
return $resource(api_url+"/persons");
});
Response Chrome or Firefox, any client:
Access-Control-Allow-Methods:GET
Access-Control-Allow-Origin:*
Content-Length:1839
Content-Type:application/json; charset=utf-8
Date:Thu, 12 Mar 2015 21:53:54 GMT
X-Total-Count:150