Hide ion-nav-back-button

I have an app where my first screen is a login, then when the user logs in I redirect my app to another view using $state.go('app.foo');

The problem is that in my ion-nav-bar I see the ion-nav-back-button, but I don’t want it when the user comes from the login.

Any ideas?

1 Like

can you use the new ‘nav-clear’


1 Like

I didn’t know about that. But how can I use it with Javascript? I am redirecting to another view using $state.go('app.foo'); only after that redirection I don’t want the back button.

Can you just apply it to whatever button causes that state change?

If not, then here is the navClear directive. Take it’s code and apply in your controller.

.directive('navClear', ['$ionicViewService', function($ionicViewService) {
  return {
    restrict: 'AC',
    link: function($scope, $element, $attr) {
      $element.bind('click', function(){
          disableAnimate: true,
          disableBack: true

1 Like

Ok, thanks @darrenahunter and @Calendee

Didn’t know about this nav-clear

FYI : Here is a sample :


Thanks! It really help me.