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

156
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
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