title: hiding back button in ionic, angularjs
body: <p>I need to show and hide back button in different pages/views. I took reference from <a href="https://codepen.io/calendee/pen/eusfl">Justin Noel</a>:</p>
  
  <pre><code>&lt;body ng-app="starter" ng-controller="AppCtrl"&gt;
    &lt;ion-nav-bar class="bar-stable"&gt;
      &lt;ion-nav-back-button hide-back-button="{{hideBackButton}}"&gt;
      &lt;/ion-nav-back-button&gt;
    &lt;/ion-nav-bar&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>App controller to toggle button display:</p>
  
  <pre><code>.controller('AppCtrl', function($scope, $location) {
     var path = $location.path();
     if (path.indexOf('submit') != -1)
       $scope.hideBackButton = true;
     else
       $scope.hideBackButton = false;
  })
  </code></pre>
  
  <p>But this doesnt work as controller is called only once but not at the change of view in different states. Also changing the value of $scope.hideBackButton from other controllers(linked to different states) does not have any effect on the button display.</p>
  
  <p>Can anyone tell me how to toggle back-button display on each navigation. What am I missing here?</p>