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

ion-tabs导航

<ion-tabs class="tabs-icon-top tabs-color-active-positive {{$root.hideTabs}}">
</ion-tabs>

hideTabs的directive js 注意app=angular.module(‘directive’, []) 注:这句比较重要

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 = 'tabs-item-hide';
                });
            });

            scope.$on('$ionicView.beforeLeave', function() {
                scope.$watch(attributes.hideTabs, function(value){
                    $rootScope.hideTabs = 'tabs-item-hide';
                });
                scope.$watch('$destroy',function(){
                    $rootScope.hideTabs = false;
                })

            });
        }
    };
})

内页需要隐藏导航 hide-tabs=”true”

<ion-view hide-tabs="true" view-title="{{investname}}">
</ion-view>
分享到:更多 ()

抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址