Answers for "angular open new tab from component"

-1

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
Posted by: Guest on March-04-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language