No back button visable following view change via $state.go

Hi all,

I have 2 views as follows

    .state('tab.matches', {
    url: '/matches',
    views: {
      'tab-matches': {
        templateUrl: 'templates/bant-tab-matches.html',
        controller: 'MatchesCtrl'
      }
    }
  })
    .state('tab.matches-detail', {
    url: '/matches/:matchId/:userId/:userName',
    views: {
      'tab-matches': {
        templateUrl: 'templates/bant-tab-matches-detail.html',
        controller: 'MatchesDetailCtrl'
      }
    }
  })

I have a button on a different view which on click calls a function in the controller as follows:

$scope.messageUser = function (postInfo) {

$state.go('tab.matches-detail', { matchId: var1, userId: var2, userName: var3 });

}

This redirects to the tab.matches-detail view as expected but a back button is not present. I would like the back button to redirect back to the parent view being tab.matches, or the view I originally redirected from. If I navigate from tab.matches to tab.matches-detail (when I have not redirected by $state.go) the back button is present. I however am going direct to tab.matches-detail when $state.go is called. As such I can no longer access tab.matches as if I click on another tab and then return to tab.matches it displays tab.matches-detail with no way to access the parent state of tab.matches. I can’t figure out how to get the back button to display. I need this to be controlled from the controller rather than a href in the view as I need to call similar functionality from an Actionsheet where the logic is all controller side.

Apologies for the rather verbose explanation but I want to be clear on the issue.

Thanks in advance for your help.

Anthony

Same here checking the $ionicHistory viewHistory says that I’m in the root history

It is weird

I tried both href approach and $state.go approach and the result is the same

If they are tabs you won’t be able to get what you expect because when you go in a tabs view it becomes it’s own history stack’s root. Have a look at this.
I override the back buttons and save the previous state when going to a tabs view, when the button is clicked I save the id of the tab that was showing so I can redirect to it when going back to tabs and $state.go to the previous view.

$ionicNavBarDelegate.back();

var options = { reload: false };
$state.go('my_destiny', 'my_params', options);

In “options”, reload need set as false