I work on angular 8
I face issue when save excel file I get error as below :
ERROR TypeError: Failed to execute 'createObjectURL' on 'URL': Overload resolution failed.
at Function.a [as saveAs] (FileSaver.min.js:1:1339)
at SafeSubscriber._next (zdeliverysys.component.ts:225:23)
what i try is :
component ts
this._dataService.PostUpload(this.fileToUpload)
.subscribe(blob => {
saveAs(blob.body, this.fileToUpload +'.xlsx');
});
service.ts
PostUpload( file:any):Observable<any>
{
const formData: FormData = new FormData();
formData.append('file', file,file.name);
return this.http.post(this.url + 'Z2Delivery/Upload' , formData,{responseType: 'blob' });
}
How to solve this issue ?
I solved my issue i modify service response on angular
from
return this.http.post(this.url + 'Z2Delivery/Upload' , formData,{responseType: 'blob' });
to
return this.http.post(this.url + 'Z2Delivery/Upload' , formData,{observe: 'response',responseType: 'blob' });
and excel file download success without any problem