Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 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.

like image 491
None Avatar asked Jul 20 '17 07:07

None


People also ask

Can I use routerLink on Div?

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.

Can we use href instead of routerLink?

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 difference between routerLink and routerLink?

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.


1 Answers

you can use query params in routerlink like below

[routerLink]="['']" [queryParams]="{ procesId : 12 }"
like image 140
Arun Kumaresh Avatar answered Sep 24 '22 18:09

Arun Kumaresh