Angular 2 - Redirect to an external URL and open in a new tab

前端 未结 9 545
离开以前
离开以前 2020-12-03 00:36

I\'m trying to Open a new page when user clicks on a link. I can\'t use Angular 2 Router, because it doesn\'t have any functionalities to redirect to an external URL.

<
9条回答
  •  有刺的猬
    2020-12-03 01:00

    I want to share with you one more solution if you have absolute part in the URL

    SharePoint solution with ${_spPageContextInfo.webAbsoluteUrl}

    HTML:

    
    

    TypeScript:

    onNavigate()
    {
        let link = `${_spPageContextInfo.webAbsoluteUrl}/SiteAssets/Pages/help.aspx#/help`;
        window.open(link, "_blank");
    }
    

    and url will be opened in new tab.

提交回复
热议问题