当用户点击链接时,我正在尝试打开一个新页面。我不能使用Angular 2路由器,因为它没有任何重定向到外部URL的功能。
所以,我使用的是window.location.href="...";
html代码:
<button (click)="onNavigate()">Google</tn-submenu-link>打字代码:
onNavigate(){
//this.router.navigateByUrl("https://www.google.com");
window.location.href="https://www.google.com";
}但是如何在新的选项卡中打开它呢?什么时候使用window.location.href?
发布于 2017-03-14 07:06:43
onNavigate(){
window.open("https://www.google.com", "_blank");
}https://stackoverflow.com/questions/42775017
复制相似问题