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

155
Visualizações
Angular 2 Get all querystrings

Is there an automated way I can get ALL of the querystrings in the address bar without knowing what the names are?

For instance I want to get all of the following:

reports?api=Report1&from=&to=&agentId=2&status=1&fixtureId=3&gradeId=4

I've had a look everywhere but I can only see examples where you can only get if it you know the name.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

I'm not sure if answer should be somehow related to angular but a simple solution would be:

  1. location.search - gets query string with all params

  2. https://www.npmjs.com/package/query-string - nice package which converts queryString to params object for your convenience.

over 4 years ago · Santiago Trujillo Relatório

0

  • ImportActivatedRoute

    import { ActivatedRoute } from "@angular/router";

  • And initialize on constructor

    constructor(private activatedRoute: ActivatedRoute) { }

  • Then use this below code to getting query string

        this.activatedRoute.params.subscribe(params => {
             let from = params['from'];                
        });
    

Edit

this this.activatedRoute.params having all query strings . but if you want get the value then you should go with subscribe. or get the whole url and need to use split(); the URL to get query strings.

over 4 years ago · Santiago Trujillo Relatório
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