Search code examples
angularangular-ui-routerangular2-services

How to get Header information from wp-api in Angular 5


I am working with a project in Angular 5 and consuming wp-api. With the help of api I showed data in Grid and apply dependent dropdowns. For the purpose of pagination I need to get header information I tried but I cannot solved the issue. With the help of below query i send to get different information from api with the single query. How do I get Header information.

 return this.http.get(this.baseUrl + this.apiUrl + '?per_page=100&page=' + page_number + '&filter[meta_value][abc]='+abc+'&filter[meta_value][def]='+def+'&filter[meta_value][ghi]='+ghi);

Solution

  • Do something like this:

    public Method () : Observable<HttpResponse<any>>  {
        return this.http.get<any>(`/api/what/ever`, 
        {observe: 'response'});
     }