ionic tabs隐藏完美解决

开发app过程中需要进行子页面tabs隐藏,网上找了N多方案,度娘出来的都是写指令,

 
 
但是测试中bug明显,于是墙外谷歌。。终于找到完美的方法,如下
 tabs.html
<ion-tabs class=" " ng-controller="TabsCtrl" ng-class="{'tabs-item-hide': hideTabs}">
</ion-tabs>
controller里
.controller('TabsCtrl', function($scope, $rootScope, $state) {
        $rootScope.$on('$ionicView.beforeEnter', function() {
var statename = $state.current.name;
//tabs中存在的主页面不需要隐藏,hidetabs=false
            if(statename ==='tabs.a'||statename ==='tabs.b'||statename ==='tabs.c'){
$rootScope.hideTabs = false;
}else{
$rootScope.hideTabs = true;
}
        });
    })
 
 
that's all...
原文地址:https://www.cnblogs.com/gytekin/p/5051738.html