I'd like to do something like, but goBack doesn't return promise:
$ionicHistory.goBack().then(function(){
$state.go('thirdState');
}
First state -> second state and when user call the method above -> first state and immediately go to some third state, so user can back only to first state. When I use:
$ionicHistory.goBack()
$state.go('thirdState');
User can still go back to my second state. What options I have to solve this problem?
Ok, I solved it this way:
var offState = $rootScope.$on('$stateChangeSuccess',
function(event, toState, toParams, fromState, fromParams){
$state.go('thirdState');
offState();
});
$ionicHistory.goBack();