Reputation: 11107
I have a ui-sref link.
<a ui-sref="tab.search-results(backTo)" nav-direction="back" class="button no-margin-top bold button-full button-stable">
<span class="assertive">BACK</span>
</a>
I'm using nav-direction
to have the transition go back. How do I do this with $state.go()
?
<a ng-click="parts.goBack()" class="button no-margin-top bold button-full button-stable">
<span class="assertive">BACK</span>
</a>
I don't see this option anywhere.
function goBack( ) {
// How do I go back via nav direction?
$state.go('tab.search-results');
}
Upvotes: 3
Views: 1391
Reputation: 15038
Use $ionicHistory. It has a goBack([backCount])
function which looks like exactly what you need.
Upvotes: 6