简体   繁体   English

在新选项卡中打开组件

[英]Open a component in new tab

I want to open my component "template1" in a new tab so I create a path:我想在新选项卡中打开我的组件“template1”,所以我创建了一个路径:

const routes: Routes = [

{path : 'template1' , component: Template1Component} ];

and in the html:在 html 中:

<a  mat-raised-button color="primary" target="_blank" [routerLink]= "['/template1']">go</a>

Expected to open the component template1 in an empty page but it is created in the same page of the current component like that:预计会在空页面中打开组件 template1,但它是在当前组件的同一页面中创建的,如下所示:

This is what I found when I click on "go":这是我点击“go”时发现的:

在此处输入图像描述

There is no problem with your HTML or routing module.您的 HTML 或路由模块没有问题。 Try to restart and check again your server.尝试重新启动并再次检查您的服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM