membersound
membersound

Reputation: 86915

How to read the full query string in angularjs from url?

I want to use angularjs to read the full query string:

http://localhost/test#/?param1=abc&param2=def

I know that var query = $location.search(); would give my an object containing each param as key-value pair.

But I want to extract the full string param1=abc&param2=def, and use this param elsewhere. Without having to know what parameters are inside the string.

Is that possible?

Upvotes: 1

Views: 433

Answers (1)

Tushar
Tushar

Reputation: 87233

Angular don't have method to get the complete querysting.

You can use url() to get the URL and then extract the querystring.

var queryString = $location.url().split('?')[1];

Upvotes: 2

Related Questions