open link in new tab from controller angular js code example

Example: 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

Tags:

Html Example