删除特定页面上的子标题(离子)

时间:2016-09-29 20:18:23

标签: html ionic-framework

我试图在特定页面上隐藏带有按钮栏的子标题,此时它显示在所有页面上。我上面有一个nav栏,它会保留在每一页上。这是标题的代码。

<ion-nav-bar class="bar-dark" align-title="center">

    <ion-nav-back-button></ion-nav-back-button>

    <ion-nav-buttons side="left">
        <button class="button button-icon button-clear ion-ios-gear"></button>
    </ion-nav-buttons>

    <ion-nav-buttons side="right">
        <button class="button button-icon button-clear ion-ios-cart-outline" ></button>
    </ion-nav-buttons>
</ion-nav-bar>





<ion-header-bar align-title="center" class="bar-subheader bar-light"  >
    <div class="button-bar">
        <a class="button button-outline button-dark">Sort</a>
        <a class="button button-outline button-dark">Categories</a>
        <a class="button button-outline button-dark">Filter</a>
    </div>

</ion-header-bar>

谢谢

1 个答案:

答案 0 :(得分:0)

根据您的评论。您可以控制如何显示您的子标题。

<强> HTML

<ion-header-bar ng-hide="hideSub" ng-init="controlSubHeader()" align-title="center" class="bar-subheader bar-light"  >
<div class="button-bar">
    <a class="button button-outline button-dark">Sort</a>
    <a class="button button-outline button-dark">Categories</a>
    <a class="button button-outline button-dark">Filter</a>
</div>

<强> CONTROLLER

app.controller('MyController', function($state, $scope){
   $scope.hideSib = false;

   $scope.controlSubHeader = function(){
       if($state.current.name === 'tab.search')
       {
           $scope.hideSub = true;
       }else{
           $scope.hideSub = false;
       }
   }
});