Domanda

Is there a way to do it?

If the current url is say..

/table?sort=activity and I wanted to update it right away, I'd do

$location.url(null, {sort: 'something'})

but what if I wanted to get back the updated url /table?sort=something without updating it?

All the $location functions seems to change the url right away when used with parameters..

È stato utile?

Soluzione

For completeness thought I'd share this SO question. The question and answers are old but there's a good chance the answer still applies.

How to programmatically create URLs with AngularJS

Altri suggerimenti

What you are looking for is $location.search()

It would look something like this:

$location.search({sort: 'something'});

Update based on comments

According to the Developers Guide, you can use the following to read the URL:

$location.absUrl();

To read the hash:

$location.path();

To read the query params:

$location.search();
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top