I need to read the response headers in component file, type of request is post request.
need to access the X-Pagination
object, but I want to read that in my component
file not in service file
here is how I tried
ngOnInit(): void {
this.paginator.pageSize = 25;
this.endUserReportService.getDailyReport().subscribe(response => {
console.log('Response of end-user-report: ', response);
this.reports = response;
this.dataSource = new MatTableDataSource(this.reports);
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
// here is how I'm trying, but its not working
this.http.get<any>(this.endUserReportService.URL, { observe: 'response' })
.subscribe(resp => {
console.log(resp.headers.get('X-Pagination'));
});
}, error => {
console.log('Error occured while end-user fetching report: ', error);
});
}