angular2 service request header response for X-Pag

2019-08-19 03:58发布

问题:

I am using angular2 service to get data response from yii2 api. In browser network tab it showing all required response but when I am trying to get it directly from component like

response.headers.get('X-Pagination-Page-Count') 

Then it's not showing anything. except only showing content-type in response header via code. but can't get a function response. below is my service function.

getResponse(endpointUrl: string): Observable<any> {

    const url = url;

    return this._http.get(url)
        .catch((err) => this._handleError(err))
        .take(1)
        .map((res: Response) => res);
}

this is response image.