ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 277.9k

error when subscribe upload file service No overload matches this ca?

Jun 15 2021 12:35 PM

I work on angular 7 I make upload to file but i face issue when call service 

it can't subscribe service and it give me error

PostUpload(selectedoptionsId, file) {

  const formData: FormData = new FormData();

  formData.append('file', file,file.name);

  formData.append('selectedoptions',selectedoptionsId.toString());

  return this.http.post('http://localhost:61265/api/DeliverySys/', formData);

}

this._dataService.PostUpload(this.selectedoptions.toString(),this.fileToUpload)

 .subscribe((response: Blob) => saveAs(response, this.fileToUpload.name + '.xlsx'));

the error display when call service actually when do subscribe as below 

No overload matches this call.
Overload 1 of 5, '(observer?: PartialObserver): Subscription', gave the following error.
Argument of type '(response: Blob) => any' is not assignable to parameter of type 'PartialObserver'.

so How to solve issue