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
3
votes
2 answers

Angular 2 - routerLink doesn't work with external links

I'm trying to work with routerLink with external links. The links are exposed on index.html (that's like a menu from an external App), like this: Index.html
3
votes
2 answers

Angular 2 routerlink with multiple routes?

I want to remove a class only one ONE route, (Or add a class on all BUT one route.) How is that possible? I have tried [routerLink] with multiple parameters to no avail:
Chris J
  • 596
  • 1
  • 8
  • 14
3
votes
4 answers

Angular 2 routes not working after aot compilation build

I am using RouterModule, I have this in my app.module.ts const appRoutes: Routes = [ { path: '', redirectTo: 'mainMenu', pathMatch: 'full' }, { path: 'mainMenu', component: MainComponent, children: [ { path: '', redirectTo:…
Eddy
  • 274
  • 3
  • 17
3
votes
1 answer

What should be an equivalent [routerLink] code for this.router.navigate code?

showBio(id) { this.router.navigate(['/speakers', {outlets: {'bio': [id]}}]); } How can I write it in [routerLink] and still can pass an id? I am following this example for reference: Example
3
votes
2 answers

angular 2 passing params in route

I have a component from where i need to pass data to another component on click of button so I have used [routerLink] property in anchor like this
Dmehro
  • 1,269
  • 1
  • 16
  • 29
3
votes
1 answer

angular 2 routerLink not working on revisit

I have the following code in my application. The navigation works when clicked on the anchor element the first time. It loads the corresponding target component and everything is good. However, when I click on the anchor element again, the url in…
Shilpa Nagavara
  • 1,055
  • 2
  • 16
  • 31
2
votes
1 answer

enable clickling on parent tag with routerlink as child vue 3

I have a RouterLink used inside a li tag and which basically makes a simple dropdown menu, When options are present on the dropdown menu I can click on the text to go to the next page but not click anywhere else inside the box, instead I want to be…
zaakm
  • 141
  • 9
2
votes
0 answers

Angular Routerlink with state and target _blank

I am trying to pass the state property with routerLink and open it on a new tab. This is my code: Without target='_blank' I can get the state value this…
Scandiuzzi
  • 75
  • 1
  • 7
2
votes
1 answer

Is it possible to add #fragment part of uri in Vaadin 14 and RouterLink?

Is it possible to add #fragment part of URI in Vaadin 14 and RouterLink? I can't find anything in Vaadin docs. I need this to have fast access to a specific part of the view from another view.
akvyalkov
  • 273
  • 5
  • 17
2
votes
3 answers

Globally changing Angular root route without changing routerLinks

Currently I have routes set up something like const routes: Routes = [ {path: "", redirectTo: "route1", pathMatch: "full"}, {path: "route1", children: [ {path: "", redirectTo: "subRoute1", pathMatch: "full"}, {path: "subRoute1",…
Scot
  • 165
  • 2
  • 14
2
votes
4 answers

Angular routerLink in Navbar is not working

I am following a tutorial and building my first Angular app (yay!). I have followed all the steps but cannot seem to find my issue. I am adjusting all of the href links in the navbar to be routerLink links. I just tried to change the "Background"…
GarbageCoder
  • 83
  • 1
  • 9
2
votes
1 answer

Laravel and Vue, vue-router link not working

I am new to laravel and Vue. what I am trying is to use vue-router to redirect to a specific link. I inserted the in the main content with id=app and also used as the code below but when I click on the link…
Mahdi-Jafaree
  • 882
  • 2
  • 9
  • 22
2
votes
1 answer

RouterLink seems to just reload the current page most of the time

I have added page navigation in my webapp using routerlinks and for some reason the page just reloads most of the time , and at the other times it works fine, very randomly. I am stumped, especially as to why it works randomly. Any insight at all…
Valkyrie
  • 140
  • 1
  • 13
2
votes
1 answer

What is a correct way to determine if clicked component has routerLink attribute?

I got a case, where I need to intercept click event and pick some additional config object from component it has routerLink attribute. How to determine if component has any? There is elementRef.nativeElement.attributes.ng-reflect-router-link but I…
ppotera
  • 61
  • 5