Ionic hide nav-bar not the buttons

前端 未结 1 483
无人共我
无人共我 2021-01-16 15:14

I am trying to find a possible way to hide the ionic ion-nav-bar without hiding the ion-nav-barbuttons.
I have tried

hide-nav-         


        
相关标签:
1条回答
  • 2021-01-16 15:31

    You just have to specify what state want to hide the bar, and modify some styles

    JS:

    $rootScope.$on('$stateChangeStart', function(ev, toState, toParams, fromState, fromParams){
    
        var states = ['tabs.about', 'tabs.contact'];
    
        if(states.indexOf(toState.name) > -1) {
          $rootScope.hideBar=true;
        } else {
          $rootScope.hideBar=false;
        }
    });
    

    HTML:

    <ion-nav-bar class="bar-positive" ng-class="{ 'make-border-trasparent': hideBar }">
      <ion-nav-back-button>
      </ion-nav-back-button>
    </ion-nav-bar>
    

    Please take a look at this example (I'm hiding the bar in the tabs.about and tabs.contact states)

    Codepen

    0 讨论(0)
提交回复
热议问题