Questions tagged [angular-routerlink]
220 questions
163
votes
4 answers
Difference between [routerLink] and routerLink
What is the difference between [routerLink] and routerLink ? How should you use each one?

Eslam Tahoon
- 2,205
- 4
- 15
- 21
35
votes
5 answers
ERROR Error: Uncaught (in promise), Cannot match any routes. URL Segment
I have simple navigation in angular 6 app,
Here is HTML

The Dead Man
- 6,258
- 28
- 111
- 193
24
votes
5 answers
Angular 7 routerLink directive warning 'Navigation triggered outside Angular zone'
I am struggling with Angular framework to get my application run smoothly, but I can't resolve an issue with routing.
I have a top level AppComponent and app-routing.module.ts which manage the navigation via my custom SlideMenuComponent. My…

Veetaha
- 833
- 1
- 8
- 19
23
votes
2 answers
RouterLink with multiple params in Angular
I want to create a link to the route with multiple parameters and bind them in tempalte. Until now, I've been doing this by executing the function on (click) event, but I was wondering if it's possible within RouterLink's binding.
Here is the…

Dawid Zbiński
- 5,521
- 8
- 43
- 70
15
votes
6 answers
Router navigate to child route - Angular 6
I've defined my routes like this:
const routes: Routes = [
{ path: '', loadChildren: './tabs/tabs.module#TabsPageModule' },
{ path: 'faq', loadChildren: './faq/faq.module#FaqPageModule' },
{ path: 'terms', loadChildren:…

Ante Ereš
- 623
- 4
- 8
- 24
15
votes
5 answers
how to pass route params in [routerLink] angular 2
I'm trying to create an application with angular 2,And Want pass params to tag a in [routerLink],i want craete a link like this :
i dont know how to pass cell in template...
user5738822
13
votes
2 answers
Angular 7.x.x easiest way to scroll to a fragment?
In the past two days i've been diggin through the internetz about scrolling a fragment into view with angular.
Let's say we have a static webpage with a bunch of id-s that act as fragments. And has a side nav-bar to navigate through the fragments…

Exitl0l
- 459
- 2
- 11
- 27
12
votes
4 answers
go back using routerLink
I'm using routerLink to go back in my page.
Current route can have 3 levels:
myurl.com/parent
myurl.com/parent/child
myurl.com/parent/child/grandchild
also, I have some differents components, so it won't be always parent, it can be parent1, or…

cucuru
- 3,456
- 8
- 40
- 74
10
votes
6 answers
Angular - Apply style to element depending on sibling RouterLinkActive?
I do not have only one menu bar on my app that I need to be painted when the user navigates, I have another components too that needs to be painted as well. Can I achieve this just using routerLinkActive?
menu.html
7
votes
3 answers
Disabling routerLink with stopImmediatePropagation method
Task - Create a reusable button/anchor tag attribute selected component for an Angular library, with as much of the logic for the behavior tied up in the component itself not on the HTML markup.
HTML markup should be as clean as possible ideally

Munerz
- 1,052
- 1
- 13
- 26
7
votes
3 answers
Angular 8 - URL loads with routerLink but doesn't show when directly access in the browser in LOCALHOST
I have developed the Angular 8 application and I am using the routerLink to navigate the components which work fine without any issue but when I enter the same URL directly in the browser it doesn't show anything and in the console, I am seeing the…

Mahesh G
- 1,226
- 4
- 30
- 57
7
votes
0 answers
using routerLinkActive with click event
How can I use routerLinkActive with click event and without routerLink?
I read somewhere that using click and routerLink together is not a good practice. I want to set an active class when I click the link and want to perform some business functions…

Pritam Bohra
- 3,912
- 8
- 41
- 72
6
votes
2 answers
Angular testing: Cannot read property 'nativeElement' of null
I am new in Angular testing and at the moment I am trying to test this piece of code but I'm getting an error concerning the event raised on the DOM:

Mellville
- 1,027
- 2
- 18
- 39
6
votes
1 answer
routerLink adding question mark in url?
I want to have route something like this : www.test.com?procesId=12 .
This is my current routerLink:
But right now i get this value :
www.test.com/123
Any suggestion how can i add in url ?procesId = 12 with routerLink ?
I tried:
But i dont get…

None
- 8,817
- 26
- 96
- 171
5
votes
2 answers
Angular Routing with Fragment Hash doesn't work if I click the same anchor twice
I am trying to redirect within the page, using a fragment in an anchor tag. It works fine the first time but when I scroll the page up manually and press the anchor link again it doesn't work.

Saad Bashir
- 4,341
- 8
- 30
- 60