I want something like this:
if ($state.get("^")) $state.go("^"); else $location.path('/');
But it apparently won't work (it always goes with $state.go
even when there's no parent state). How to correctly do a check if an particular state exists?
you could use $state.href which will return null if the state does not exist. See http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With