angular open new tab code example

Example 1: angular open pdf in new tab

<a href="../assets/documents/test.pdf" target="_blank"> Read More </a>

Example 2: angular open new tab from component

In case someone runs into the same issue I ran:

I ended using localstorage to temporarily store my object and access it from the other window.

So the code ended up like:

<a target="_blank" [routerLink]="['/details', item.name]" click="passObject(item.name)">
passObject(i){
    localStorage.setItem('i.name', JSON.stringify(i));
}
And in the details component:

ngOnInit() {
    this.item = JSON.parse(localStorage.getItem(param));
}
Another idea that I could try is implementing a message service