Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

142
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda