Ion-item href not showing back button on nav-bar when clicked


#1

Hi, I have a ion-list with ion-items on a view, and each item has an href attribute. When I tap on an item, the navigation works ok, but on the navbar I can see the menu icon (the 3 horizontal lines), instead of back button.

Yes, all my views have a side menu.

This only happens when I have href on an ion-item. I have ng-clicks in buttons and other elements, and the history is saved ok (I mean I can see the back button on the navbar).

Does anyone experiments the same issue?
How can I get the back button to appear instead of the menu icon when I click on an item list?

My ionic info is:

OS: Mac OS X Mountain Lion
Node Version: v0.10.34
Cordova CLI: 4.1.2
Ionic CLI Version: 1.3.2
Xcode version: Not installed
ios-sim version: Not installed

Thanks!
Pablo.


#2

Also when we click on the ion-item, the next view is displayed without doing the animated transition. That’s weird.

We also tested it using a class=item instead of ion-item, and also using ui-sref instead of href and nothing happens: the back button doesn’t appear and the animated transition is not done.

Any ideas?


#3

Could you replicate this in a codepen so we can see what you mean?


#4

I’m pretty new to ionic, not sure how to put my ionic project on codepen. Any pointers?

Please let me know what part of my message is not clear so I can explain. Thanks!


#5

Here is a codepen you can go off of: http://codepen.io/anon/pen/vEmWbe?editors=101

If you fork the codepen you can modify the ion-item to show the broken navigation, and then save the codepen and paste the URL here. The first page has an ion-item with a ui-sref redirecting to page 2 and it is working. If you could change the codepen that would be helpful to narrow the problem down. :smile:


#6

Awesome, thanks for the help. Will try to replicate in codepen.


#7

What about the navigation and history when using a side-menu?
It does not seem to work: http://plnkr.co/edit/Pea47zyRtDEIugWGWBP7?p=preview
Could you please help?


#8

What do you mean? What isn’t working?


#9

If I click on the contacts button (see plunker) I’ve got the back button showing in my navbar left-corner.
If I click on the contacts in the side-menu nothing happens.
I don’t understand why it does not show the back button in this last situation.


#10

This is caused by the menuClose directive on the sidemenu links. It is setting the next view as the history root which is why the back button doesn’t show.

Here’s the code on menuClose: https://github.com/driftyco/ionic/blob/master/js/angular/directive/menuClose.js

 $ionicHistory.nextViewOptions({
   historyRoot: true,
   disableAnimate: true,
   expire: 300
 });
 sideMenuCtrl.close();

Here’s a post on using menuClose without resetting the history stack:

Or you could remove the menuClose directive and call a function that just closes the menu.