I'm trying to get window.open
to open in a new tab. The new tab is basically a PDF file which would prompt the user to download.
Here's my Angular 4 Code:
download() {
const data = {html: this.template.toArray()[0].nativeElement.innerHTML};
this.authService.generateResume(this.template.toArray()[0].nativeElement.innerHTML).subscribe(res => {
const path: string = res.success;
const uri = path.substring(path.lastIndexOf('/'), path.length);
window.open('http://example.com/pdf' + uri, '_blank');
})
}
I understand window.open
is treated as a popup.
How can we go around this?