Reputation: 1179
I want to use the location path and anchor link (a link to an element in the page). So i can use the value in my controller
So i have a path in my browser like so:
/atomics#icons
/atomics
is the route and #icons
is a link inside the page to an element
When i use $location.path()
in my controller I only get /atomics
,
i want to get #icons
value aswell. Is this possible?
Upvotes: 1
Views: 3897
Reputation: 534
To redirect to /atomics#icons from another location you have to give both below commands:
$location.hash('icons');
$location.path('/atomics');
Upvotes: 0
Reputation: 8866
Assuming you have an URL like /atomics#icons
you can use the following $location
functions to extract parts of it:
/atomics
icons
In case you want to extract querystring values you can also use $location.search()
.
Official $location documentation.
Upvotes: 4