In our application, on a button click within a table, I need to open a new tab containing details of a record in the table. Using the below code I am navigating to a new URL. On the new page, resolvers are used to fetch details from back-end. Now the problem is I want to open this in a new tab.
this.router.navigate(['/url/test'], {
queryParams: {ip},
});
I tried the below code. But it doesn't seems to work. It is redirecting to the default URL:
this.router.navigate([]).then((result) => {
window.open('/url/test?aa=' + aa, '_blank');
});
Any help would be appreciated.
In our application, on a button click within a table, I need to open a new tab containing details of a record in the table. Using the below code I am navigating to a new URL. On the new page, resolvers are used to fetch details from back-end. Now the problem is I want to open this in a new tab.
this.router.navigate(['/url/test'], {
queryParams: {ip},
});
I tried the below code. But it doesn't seems to work. It is redirecting to the default URL:
this.router.navigate([]).then((result) => {
window.open('/url/test?aa=' + aa, '_blank');
});
Any help would be appreciated.
Share Improve this question edited Sep 4, 2020 at 16:00 Kate Orlova 3,2835 gold badges14 silver badges36 bronze badges asked Sep 4, 2020 at 10:37 user2900572user2900572 6213 gold badges9 silver badges24 bronze badges 1-
1
You don't the
router
to open a window. Remove the call torouter.navigate
and just callwindow.open
. – The Head Rush Commented Sep 4, 2020 at 10:41
1 Answer
Reset to default 4I was using useHash as true for my urls, so when i navigated with hash in url it started working.
this.router.navigate([]).then((result) => {
window.open('/#/url/test?aa=' + aa, '_blank');
});