Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
Angular2 router navigate with multivalued query params

Say, I've got a URL with multivalued parameter like:

http://my-domain.com?param1=aaa&param1=bbb

activatedRoute.snapshot.queryParams will equal to: { param1: ['aaa', 'bbb'] } - an object with both param1 values.

So far so good. Now, I want to modify one of the values. With "normal", single values parameters I do it with

router.navigate(['.'], { queryParams: { param: 'newValue' }}

However, when trying with an array of values:

router.navigate(['.'], { queryParams: { param1: ['aaa', 'ccc'] }}

it doesn't produce ?param1=aaa&param1=ccc, but ?param1=aaa,ccc instead.

The question is: how can I navigate to ?param1=aaa&param1=ccc modifying just one of multiple values of a single param? I hope there is a better option that building the whole URL myself and using router.navigateByUrl...?

Ultimately I can rewrite it to utilize comma-separated param1=aaa,ccc notation, but I'd like to avoid it.

ng version is 2.4.9

Thanks for your suggestions.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!