The following typescript code will always open in the current browser tab
navigate($data: menuItem, $event: JQueryEventObject) {
//...
let a = $event.currentTarget as HTMLAnchorElement;
router.navigate(a.href);
}
How do I make router.navigate open in a new tab ? (that is when $event.ctrlKey is true)
this is my solution
const url = this.router.serializeUrl(this.router.createUrlTree(['/my/url/route'], { queryParams: { ...anyQueryParamsYouWantOrOmitThis } }));
window.open(url, '_blank');