AngularJS UI-Router : Get the absolute URL of the state with the parameters
Solution 1:
You should use $state.href()
.
-
To get the absolute URL you can then use:
$state.href('user.home.view', {}, {absolute: true});
To get the URL with the parameters in place you need to add them as the second argument
Solution 2:
What about :
$state.href($state.current.name, $state.params, {absolute: true})
Solution 3:
For getting the absolute URL without parameters, I'm finding I need to pass inherit: false
, eg:
$state.href('home', {}, {absolute: true, inherit: false})
Without inherit: false
I was getting any/all params that may be present.