How to open a link in new tab using angular?

后端 未结 9 1515
温柔的废话
温柔的废话 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:32

    Use window.open(). It's pretty straightforward !

    In your component.html file-

    page link
    

    In your component.ts file-

    goToLink(url: string){
        window.open(url, "_blank");
    }
    

提交回复
热议问题