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”,