質問

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

役に立ちましたか?

解決

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

他のヒント

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();
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top