How to open a link in new tab using angular?

后端 未结 9 1513
温柔的废话
温柔的废话 2020-12-08 13:03

I have an angular 5 component that needs to open a link in new tab, I tried the following:

page link         


        
9条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-08 13:26

    In the app-routing.modules.ts file:

    {
        path: 'hero/:id', component: HeroComponent
    }
    

    In the component.html file:

    target="_blank" [routerLink]="['/hero', '/sachin']"
    

提交回复
热议问题