Reputation: 2098
My API manages pagination via headers and I try to handle these in angular.
If I use chrome console I can find headers :
My responses handling method :
/**
* Get the body of an HTTP response.
*
* @param res
* @returns {any|{}}
*/
private static handleBody(res: Response) {
console.log(res.headers);
return res.json() || {};
}
the result is :
How can I get my pagination headers in my angular app ?
Upvotes: 0
Views: 223
Reputation: 250842
I suspect your browser is trying to protect you by not exposing custom headers.
You can permit headers by adding an additional response header:
Access-Control-Expose-Headers: X-Page, X-Per-Page, X-Total, X-Total-Pages
You should then be able to access these in the response.
WIthout this, you may only be able to access the simple headers:
Upvotes: 1