Is there a way to open only one tab at a time, where the previous tab needs to be closed before opening another one? I have a button that opens the tab upon clicking:
onClick(){
let url = this.router.createUrlTree(['/user/', this.id]);
window.open(url.toString(), "_blank", "resizable=no, toolbar=no, scrollbars=no, menubar=no, status=no, directories=no, location=no, width=1000, height=600, left=" + horizontal + " top=100 " );
console.log(this.data.maxtab);
}
This action takes you to the "user" component which is nested within another component.
If one tab is already opened and an attempt is made to open another component, the focus should remain on the currently opened tab.
I've tried changing a variable called maxtab in the ngOnDestroy lifecycle hook of the component but it was unsuccessful. How can I achieve this functionality? Would using OnBeforeunload in JavaScript help (I researched it but couldn't implement it), or are there other methods available?