admin管理员组文章数量:1390974
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');
});
版权声明:本文标题:javascript - Angular 9: how to open URL in a new tab using route.navigate() with query string? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744753039a2623294.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论