In Angular, I need to open a PDF in a new tab and allow the user to download it with a specific name (Example.pdf). The code below downloads the PDF however doesn't open a new tab (target=_blank
is not working). Any ideas how to fix this?
show(blob){
var fileURL: any = URL.createObjectURL(blob);
var a = document.createElement("a");
a.href = fileURL;
a.target = '_blank';
a.download = "Example.pdf";
a.click();
}