Created
April 24, 2023 12:27
-
-
Save maximLyakhov/759923401c85428bd713c3ab2c1ac9bf to your computer and use it in GitHub Desktop.
Angular Router: Open In new Tab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Component { | |
public navigate({row: {id}, type}: RowAction<Item>): void { | |
if (type.includes('ctrl')) { | |
const url = this.router.serializeUrl(this.router.createUrlTree([id])); | |
window.open(url, '_blank'); // new tab | |
return; | |
} | |
this.zone.run(() => this.router.navigate([id])).then(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment