← 返回博客
ionic2016-07-05 18:47:24 6425

ionic,隐藏底部导航栏

ionic 进入二级目录以后隐藏底部导航栏(tabs)

1.在标签ion-tabs中添加:ng-class=”{‘tabs-item-hide’: $root.hideTabs}”

2.添加angularjs的指令,源码如下:

//app已经在其他文件中指定,如var app = angular.module("starter",["ionic"])
app.directive('hideTabs', function($rootScope) {
    return {
        restrict: 'A',
        link: function(scope, element, attributes) {
            scope.$on('$ionicView.beforeEnter', function() {
                scope.$watch(attributes.hideTabs, function(value){
                    $rootScope.hideTabs = value;
                });
            });

            scope.$on('$ionicView.beforeLeave', function() {
                $rootScope.hideTabs = false;
            });
        }
    };
});
3.在你想要隐藏的界面标签 ion-view添加表达式hide-tabs=”true”,

相关推荐