I am having a link which I tries to open in a new tab in angular. But my routing is always going to home since the route that the link creates will be always unique. What have I tried. In component.html file
<a (click) = openFile(element)/>
In .Ts file
openFile(myFile: any){
this.myService.getFile.subscribe((res: any) => {
const file = new Blob([res]);
//file = myOutputfile.pdf
window.open(file);
}
So, the above code actually opens a new tab, but then again redirecting to home page. First the new tab opens with localhost://myOutputfile.pdf, then immediately getting routed to localhost://home. The entire angular routing module gets called. How can I solve this.