0
I’m having a very simple doubt on Angular 2.
I have an application that connects with Rest API of Wordpress and I’m having a problem that I imagine is very simple, but I’m not finding on the web a solution.
I need to recover the data that comes in http-headers in the API I’m accessing, data that comes as total posts and number of pages, I know what are the parameters, but I can’t access them.
How do I access information in Header?
Below is the code of the method I request:
getNoticias(page: number) {
return this._http.get(this._apiUrl + "noticias/?page=" + page, { headers: this.getHeaders()})
.map(res => res.json())
.catch(this.throwError);
}
Angularjs is one thing, Angular 2 is another. JSON does not have header, probably what you need is to access the header of a HTTP request that has as payload a JSON. It would be good for you to [Edit] the question and add the code you use to make the call to the API.
– Jéf Bueno
In fact, I marked http-headers in the tags, but in doubt I marked the wrong way.
– Jeffersson Galvão