I want to open this router link in a new tab instead of same tab

Razana Razak

This is my function which directs to the page route

.ts file

readmoreFunc(data:any){
this.showId = data._id;
this.contentType =data.type
this.router.navigate(['/dashboard/dashboard-content/', this.showId,this.contentType])}

showId and contentType are my params. for eg"(http://localhost:4200/dashboard/dashboard-content/ckhewcmcj000v98t9zcb89rz0/Recent-Post) i want to open it in another tab in chrome.

bahadrdsr

Try this,

 const url = this.router.serializeUrl(
        this.router.createUrlTree([`/dashboard/dashboard-content/${this.showId}/${this.contentType}`])
      );
 window.open(url, '_blank');

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

React-Router open Link in new tab

Open link in a new tab

how i open this link in new tab?

React Router - Open Link on new Tab and Redirect to Home Page

Can vue-router open a link in a new tab?

phpBB open link in new tab

Open link in new tab or window

Vaadin open link in new tab

Button to open link in new tab

pandoc: Open link in new tab

If statement to open a link in new tab

angular tab selection opens new page instead of open in the same page

sessionStorage is cleared when you open a link on a new tab, but preserved when the link is opened on the same tab. Why?

I want to open a new tab and immediatly run a function

Open a new tab in the same directory

How can I open a link in a new tab if it has target=_blank?

Rails: Open link in new tab (with 'link_to')

how to override ngx-quill editor link and make it open in the same tab? By default it opens in new tab

How to open a link embeded in a webelement with in the main tab, in a new tab of the same window using Control + Click of Selenium Webdriver

python selenium open link in new tab and continue session in new tab

How to open a link in a new tab without seeing the URL in new tab?

How to open a link via "router.push" in a new tab using Nextjs router from next/navigation

chrome extension to open in new tab instead of popup

Is there a Mac key combination to open a link in the same tab?

How to open a link in a new tab using react?

Whole row in clickable link not open in new tab

How to open a link in new tab using javascript

Bind click event to open a link in new tab

open external link in angulardart in new tab/window