1.index.html
<script src="js/directive.js"></script>
2.directive.js
angular.module('ibg.directives', []); angular.module('ibg.directives').directive('hideTabs', function ($rootScope) { return { restrict: 'A', link: function(scope, element, attributes) { scope.$on('$ionicView.beforeEnter', function() { $rootScope.hideTabs = true; scope.$watch(attributes.hideTabs, function(value){ $rootScope.hideTabs = value; }); }); scope.$on('$ionicView.beforeLeave', function() { $rootScope.hideTabs = true; }); } }; });
3.tabs.html
<ion-tabs class="tabs-icon-top tabs-color-active-positive" ng-class="{'tabs-item-hide': $root.hideTabs}"> </ion-tabs>
4.不隐藏的tab
<ion-view view-title="IBeautyGuru" ng-controller="HomeCtrl" hide-tabs='false'> </ion-view>
本文转自ZH奶酪博客园博客,原文链接:http://www.cnblogs.com/CheeseZH/p/4788569.html,如需转载请自行联系原作者