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 question mark in url and also i get an error:
Cannot match any routes.
I know that i can get question mark when i use params but i want to use it with routerLink, because thats the way they use it on this project.
Can I use routerLink on Div? Angular 2+ Yes it can be attached to div tag, your route is probably wrong try add / in front of route.
In this case since they are served at two different base urls(in this case for dev environment its localhost:4201 && localhost:4202) using router link will not actually route you to the other base route location. Using href is required or it will fail routing you to the correct url.
What is the difference between [routerLink] and routerLink ? How should you use each one? They're the same directive. You use the first one to pass a dynamic value, and the second one to pass a static path as a string.
you can use query params in routerlink like below
[routerLink]="['']" [queryParams]="{ procesId : 12 }"
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