离子隐藏导航栏不是按钮 [英] Ionic hide nav-bar not the buttons

查看:111
本文介绍了离子隐藏导航栏不是按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出一种隐藏离子 ion-nav-bar 而不隐藏 ion-nav-bar 按钮。

我尝试过

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-bar="true"

但它也是隐藏按钮。我已经搜索过,还提到了,但没有解决我的问题。

but it is hiding buttons too. I have searched and also referred this, but nothing solved my problem.
regards.

推荐答案

您只需指定要隐藏栏的状态,样式

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>

请看看这个例子(我隐藏了 tabs.about tabs.contact 州)

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

Codepen

这篇关于离子隐藏导航栏不是按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆