How to properly change the $ionicHistory / ion-nav-back-button


#1

I am playing with Ionic for 3 days and one thing got me.
I have 2 tabs: A - dashboard and B - users

Dashboard have only one deep level (A1). Users have 2 deep levels:
B1: where it shows a list of users
B2: where it shows info about the clicked user in B1.

Wheres the problem?

Clicking in some user in B1, the app goes to B2 and there is a back button to B1. Nice.
However I have a link to the last added user in A1 (see picture). Then, when clicked it goes to B2 but theres no back button, not even to A1. How can I put a back button there pointing to B1?

I know about $ionicHistory, but don’t know what to do exactly.

Thanks


#2

I don’t use $ionicHistory
I use:

<a onclick="window.history.back();" class="button button-icon iconcolor icon ion-navicon"></a>

just window.history.back();
and it works. You can try.


#3

@motiurion Yeah this works partially, because of 2 things:

  • It returns to A1 (Dashboard) and I want B1 (Users List);
  • Now when I click on the “Users Tab” it goes directly to B2 (User detail) and not to B1(Users list). I mean, It`s impossible to return to Users list.

I have just 4 days with Ionic. I’m going to see what can be done here and update accordingly.


#4

can you provide any codesnip which you done?, it will be helpful for better understanding.