Questions tagged [routerlink]

This is used by Angular (2+ maybe Angular JS too -not sure of that) to control navigation between UI components. It acts like a Controller/traffic cop, passing state information on via a URL. Here is the official link to the documentation

312 questions
12
votes
4 answers

set target= '_blank' in router-link of vuejs 2.5

Using vuejs 2.5 if there is a way in router-link to set target= '_blank' ? I tried this way: but failed... Thanks!
user2339232
  • 757
  • 3
  • 11
  • 22
11
votes
1 answer

Angular 5 Cannot match any routes on named outlet of lazy loaded module

My Route of the Root Module is like this: RouterModule.forRoot([ { path: '', redirectTo: 'management-portal', pathMatch: 'full' }, { path: 'management-portal', loadChildren:…
LittleNewb
  • 153
  • 2
  • 2
  • 10
9
votes
2 answers

How can I navigate to an anchor in Angular 7

I've enable the anchorScrolling in routingModule and all the path but when i click on links nothing happened. 'nav-bar.component.html'
samy ben
  • 125
  • 1
  • 1
  • 8
8
votes
1 answer

vuejs component keeps the link to the root path always active

I have my navigation like this
7
votes
2 answers

How can I use relativeTo property in html template along with routerActive?

I need to use 'relativeTo' property as well as 'routerLinkActive' directive in my application. Having a click listener function that routes using router.navigate(this.router.navigate(['path']{relativeTo:this.route}); would be okay. But in that…
PCK
  • 1,254
  • 6
  • 20
  • 37
7
votes
2 answers

RouterLink Array

I've got a hyper link that I need to make a routerlink in Angular 4. I have a lot of parts to the url, part of which is an array. I'm not sure how to make the array split itself into parts for the routerlink array. Take this contrived…
Darthg8r
  • 12,377
  • 15
  • 63
  • 100
6
votes
2 answers

How to use routerLink inside SVG path?

Hello Is there a way to make routerLink Angular 6 inside different elements of one SVG?
carak
  • 97
  • 7
6
votes
1 answer

Routerlink works without anchor tag

I just noticed that routerLink works on any element e.g on divs, mat-card, mat-title, etc, without needing to wrap an anchor tag around. Is that okay / safe to do so or you need to use it with the anchor ? Maybe it can have some bad consequences…
CodeHip
  • 367
  • 5
  • 18
6
votes
1 answer

RouterLink breaks routes by replacing ? with %3F

I have console.log correctly showing the route with customer? however, with the [RouterLink] it is converting it from ? to %3F in which my route no longer works template html Route file { path: 'customer',…
user9036522
6
votes
1 answer

routerLinkActive in Angular 4 doesn't add class when only parameter changes

I have a problem with routerLinkActive in angular 4. I have this setup. export const FruitRoutes = [ { path: 'fruits/:id', component: FruiteNav, children: [ {path: '', component: FruitGeneral}, {path:…
Jens Alenius
  • 1,931
  • 2
  • 16
  • 20
6
votes
2 answers

Angular 4 conditional routing/components

UPDATE: See below So I have an app where I have two different organisations, when a user is using the app I therefore want to load different components depending on which organisation he belongs to. Approach 1: Do a simple conditional in a routes…
Out of Orbit
  • 543
  • 2
  • 5
  • 17
6
votes
5 answers

Angular 4+: RouterLink in element not working properly

I have placed my AppRoutingModule inside imports of @NgModule of AppModule class. AppRoutingModule is defined in such way: const APP_ROUTES : Routes = [ { path: '', redirectTo: 'home', pathMatch: 'full', }, { …
Michał Ziobro
  • 10,759
  • 11
  • 88
  • 143
6
votes
1 answer

Angular 2 Adds Trailing Slash To URL With Multiple Router Outlets

I have an app component that has two outlets: template: '' I followed the example in this link to create the routing and the routerLinks and everything works fine as long as…
5
votes
3 answers

How to enable "ctrl+click" with "routerLink" in Angular

In Angular, if you use this:
When I press on image it routes perfect, I want to press ctrl+click to open this link in new tab, or drag this image to a new tab, but when I press ctrl+click it opened…
Marvin Ericson
  • 239
  • 2
  • 7
  • 20
5
votes
2 answers

Template parse errors:Parser Error: Unexpected token - RouterLink

On the below error . Am getting template parse error on RouterLink . What is the correct way to use the RouterLink in Angular 2 ? Unhandled Promise rejection: Template parse errors:Parser Error: Unexpected token / at column 2 in [[/events]]…
Ansar Samad
  • 572
  • 2
  • 11
  • 34
1
2
3
20 21