Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

144
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda