How to open a new browser Tab , if using router.navigate .
this.router.navigate([]).then(result => { window.location.href = link; });
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.
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.
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.
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 −
Try this one.
this.router.navigate([]).then(result => { window.open(link, '_blank'); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With