This simple problem is bugging me. I have a custom value in my response header from the Web Api Rest server. I can see it it Firebug as: X-TotalPages 204 I try to get it in my AngularJS controller. Code below. But I cant find any good examples how to do this. console.log(headers()['X-TotalPages']); logs 'undefined'
var assets = angular.module("Assets", ['ui.bootstrap']);
assets.controller('AssetSearchController', function ($scope, $http) {
$scope.test = 'very';
$scope.getItems = function () {
$http({ method: 'GET', url: 'http://localhost:57772/api/assets', params: { search: 1, page: 0, pageSize: 10 } }
).success(function (data, status, headers, config) {
$scope.currentPage = 4;
console.log(headers()['X-TotalPages']);
$scope.items = data;
}).
error(function (data, status) {
console.log(JSON.stringify(data));
console.log(JSON.stringify(status));
});
};