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

154
Views
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 answers
Answer question

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 Report

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 Report
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!