Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Specifying multiple values for a parameter in Angular

Does Angular support sending multiple values for a single query parameter. In theory it should as it provides convertToParamMap method that can get all values for a single parameter.

I was trying to use the following syntax in my html template:

<a [routerLink]="['/first-component']" [queryParams]="{param1:'value1, value2'}" routerLinkActive="active" >First Component</a>

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

… however the value 'value1, value2' always comes as one value – not two as I would want it to.

My question is : What is the correct syntax for that?

>Solution :

Should probably be an array of strings like:
[queryParams]="{param1:['value1', 'value2']}"

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading