我正在使用Angular 5和Angular5csv导出csv,我想检测下载的文件是否已完成下载,以便添加成功消息,如何实现?
这是我生成csv文件的代码:
downloadReport(reportName){
this.reports = [];
this.loadReport = true;
this.data.getReports(rosterId,reportName)
.subscribe((data:any)=>{
var report = data.value.toString().replace(/['"]+/g, '').split('\n');
for (let index = 0; index < report.length; index++) {
this.reports[index] = report[index].split(',');
}
this.loadReport = false;
new Angular5Csv(this.reports,reportName.replace("_",' '));
this.logger.success("Success","Downloaded report successfully."); // Add success message here after download
},()=>{
this.logger.error("Error","An error occured while processing your request.");
this.loadReport = false;
});
}