Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the full url of the current ui-router state?

I'm using ui-router for AngularJS; I'm handling the '$stateChangeSuccess' event, and trying to get the full path (after '#') for the current state. $location.hash() returns an empty string and $state.url returns only the portion of the path that applies to the nested state.

My full path #/a/b

$state.url == "/b"
$locadtion.hash() == ""

How can I get #/a/b or /a/b?

like image 206
Trevor Avatar asked Dec 17 '13 22:12

Trevor


1 Answers

You can always use:

window.location 

or:

window.location.hash 

(if that's what you want).

like image 189
Ben Avatar answered Sep 26 '22 15:09

Ben