[Solved] Detect if ion-nav-button is shown

I’m trying to do this but $rootScope.$viewHistory gets ‘undefined’.
That embarassing. But other people signed this.

By the way, the working method to check the state of back button is this:

I did so:

$rootScope.$on('$ionicView.beforeEnter',function(e,data){
     $rootScope.isBackButtonShown = data.enableBack
)}

in the view:

 <button ng-if="!isBackButtonShown" ng-click="myGoBack()"></button>

that was to hide my custom back button if there is already yhe IONIC one

1 Like