Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 Routing navigate run in new tab(Use Angular Router naviagte )

Tags:

How to open a new browser Tab , if using router.navigate .

this.router.navigate([]).then(result => { window.location.href = link; });
like image 444
CodeMan Avatar asked May 25 '18 04:05

CodeMan


People also ask

What is angular routing and navigation?

This page will walk through Angular routing and navigation example. Using Angular router we can navigate from one view to next while performing our task. Every component can be mapped with a URL and when that URL is accessed by browser or by a link on the page then the corresponding component is displayed.

How to add components for routing link in angular?

Adding components for routing link. To use the Angular router, an app needs to have at least two components so that it can navigate from one to the other. To create a component using the CLI, enter the following at the command line where first is the name of your component: content_copy. ng generate component first.

How do I use the router in angular?

To use the Angular router, an application needs to have at least two components so that it can navigate from one to the other. To create a component using the CLI, enter the following at the command line where first is the name of your component: Repeat this step for a second component but give it a different name.

What is nested routing in angular?

When router-outlet is used in a component other then root component, the routes for the particular component has to be configured as the children of the parent component. This is called Nested routing. Let us consider a component, say ItemComponent is configured with router-outlet and has two routerLink as specified below −


1 Answers

Try this one.

this.router.navigate([]).then(result => {  window.open(link, '_blank'); });
like image 133
Manish Vadher Avatar answered Oct 09 '22 00:10

Manish Vadher