Side menu with back button and nav-clear issue


#1

Hello everyone,

I’m trying to create a side menu to access to the main sections of the app (first level) and inside those sections there would be other nested sub-sections (second and subsequent levels, not available through the side menu).
Obviously I only want the ion-nav-back-button to be visible when navigating in the nested sections, so I set the nav-clear directive in al links of the side menu (first level of navigation).

The problem is when I click on the “home” option of the side menu and then to any one, the back button appears, even though the nav-clear directive.
Here’s an example which reproduces the issue: http://codepen.io/anon/pen/CIejd?editors=101

Is it the normal behavior? Is there something wrong in my code?.

Thank you beforehand.
Rafa


Back button and $stateChangeStart listener
#2

Hi, you can use $ionicViewService to tell your controllers what happens on your next view.

Inject $ionicViewService on your controller and put

$ionicViewService.nextViewOptions({
  disableBack: true
});

This will cause your next page to not have back button.
I think anyways that pressing the android back button would get you back, but you can override the default behaviour of your back button to prevent that.

Saludos.


#3

Thanks for the suggestion.
Nevertheless my question is regarding how is possible that the “back” button is displayed after pressing on a button / link that has the nav-clear directive.


#4

Nobody experienced this issue?


#5

Very new to this framework. However, I notice you have the ‘nav-clear’ directive in the anchor tag <a> inside of your <ion-item> parent. The apps I have created off the side-menu template have the nav-clear directive applied to the parent <ion-item> before the menu-close directive. Perhaps this would address your issue?


#6

No luck, I still see the same issue.
Thank you anyway!.