I work on angular 7, I create in my .Net Core API a controller which when it is used it will send a file to the user and he can download this file.
In my angular application I want to know if it's possible to detect the different event link to the download of the file.
I see this on developper mozilla :
function handleChanged(delta) {
if (delta.state && delta.state.current === "complete") {
console.log(`Download ${delta.id} has completed.`);
}
}
browser.downloads.onChanged.addListener(handleChanged);
I try to do this in my angular application but I have an error message with this line of the code :
browser.downloads.onChanged.addListener(handleChanged);
Thank you for your help.
edit :
my download service :
generatePDF(elt){
return this.http.post(`${this.config.catchApiUrl()}PDF`,elt,{responseType : 'blob', reportProgress:true}
);
}
my download service caller :
onFormSubmit() {
this.generateService.eltToGeneratePDF(1).subscribe(
r => {
this.generateService.generatePDF(r)
.subscribe(
r => {
console.log("yeah")
saveAs(r)},
err => console.log(err)
)
}
)
}