Angular 2 Routing navigate run in new tab(Use Angular Router naviagte )

我怕爱的太早我们不能终老 提交于 2019-11-28 04:23:48

问题


How to open a new browser Tab , if using router.navigate .

this.router.navigate([]).then(result => { window.location.href = link; });

回答1:


Try this one.

this.router.navigate([]).then(result => {  window.open(link, '_blank'); });



回答2:


currently i believe angular doesn't offer any method or service to do that so i've to use window object to open links in a new tab window.open(link, '_blank')



来源:https://stackoverflow.com/questions/50521494/angular-2-routing-navigate-run-in-new-tabuse-angular-router-naviagte

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!