I want to download file from my Rest API with FileSaver. In response headers in Content-Disposition I have filename. How can I read header in angular? When I set my service like this:
getPdf() {
return this.httpClient.get(this.url, {responseType: 'blob'}); }
I can download file without any problems, but when I want to set additionally {observe: 'response'} to read header in options I have error in my browser.
ERROR TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided.
at saveAs (FileSaver.js:112)
My function to save file:
this.packageService.getPdf().subscribe(
pdf => {
saveAs(pdf);
}
);
I added Access-Control-Expose-Headers on my backend, only when i added {observe} there is an error so i can't find solution for this one.