Transitioning from state A directly to the child of B with possibility to go back to the B


#1

Is it possible to have “Go back” button (B title should become the back button text) in the child of state B after direct transition from state A?

For example, I have these states:

.state("app", {
  url: ''",
  abstract: true
})
.state("app.home", {
  url: "/home",
})
.state("app.cars", {
  url: "/cars"
})
.state("app.cars.item", {
  url: "/:id"
});

I want to make a transition from the state “app.home” to the “app.cars.item” and have “Go back” button to the “app.cars”. The problem is that Ionic won’t show “Go back” button to this state if there is no such view in $ionicHistory. Maybe it’s possible to do it manually?


#2

Yes, this is possible if you build it manually with state.go and ng-click


#3

@NathanS yes you can, but if you do this manually, then the view title won’t be clipped if the title is too long and overflows back button text. Back button text also won’t be hidden if the view has long title. And what about transition direction? “app.cars” is not in $ionicHistory, that means when you click “Go back” the transition will be “forward”. So I don’t think that this solution would work for me.


#4

Any other thoughts on this?