AngularJS $http response header
You should use: headers('X-TotalPages')
(Posting Wawy's answer so the question can be resolved.)
For $http(url).then() syntax which replaced $http(url).success().error() in newer versions of AngularJS, I used this:
$http(url).then(function(response){
response.headers("X-TotalPages");
});
Just using response.headers() will give all headers attached in response.