I have situation where I need to simulate several download requests on one button click. My code is here:
download(filename: string) {
console.log(filename);
const href = <my href>;
let a = document.createElement('a');
a.setAttribute('style', 'display: none');
a.href = href;
a.download = filename;
a.click();
a.remove();
}
downloadFiles(className) {
for (let docLink of this.component.nativeElement.getElementsByClassName(className)) {
docLink.click();
}
}
but the problem here is that file download is initiated only for one file instead of 3. What might be the problem?