$state.go('^') should transition to first non-abstract parent state
Whereas $state.transitionTo('^') should stay as it is (throws an exception).
Naive implementation is very easy:
$state.go = function go(to, params, options) {
// special case
if(to==='^'){
to = $state.$current;
do{
to = to.parent;
}while(to.abstract)
}
return this.transitionTo(to, params, extend({ inherit: true, relative: $state.$current }, options));
};
But wouldn't that be somehow inconsistent with the rest ?
+1
If it is consistent add a parameter, but this would make the implementation of a back method really easy.
yeah maybe a transition option closestNavigable, where, if set to true, will allow navigating to abstract states without throwing an error if they have a navigable ancestor (and maybe also child?).
+1
+1
+1
+1
+1
+1
+1
Closing this really old issue. I don't think we should change the semantics of what "^" means (parent state).
The closest navigable parent can be found at
$uiRouter.globals.$current.parent.navigable
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
This does not mean that the issue is invalid. Valid issues may be reopened.
Thank you for your contributions.