我需要从后端下载一个excel,它返回了一个文件.
当我执行请求时,我会收到错误:
TypeError:您在需要流的地方提供了"undefined".你
我的代码是:
this.http.get(`${environment.apiUrl}/...`)
.subscribe(response => this.downloadFile(response, "application/ms-excel"));
我试着找到 map (…)但没用.
详情:angular 5.2
参考资料:
import { HttpClient } from '@angular/common/http';
import 'rxjs/add/observable/throw';
import 'rxjs/add/operator/finally';
import 'rxjs/add/operator/map'
import 'rxjs/add/operator/catch';
响应的内容类型:
Content-Type: application/ms-excel
发生了什么?