ZH奶酪:Ionic通过angularJS+tabs-item-hide实现自定义隐藏tab
参考链接:http://stackoverflow.com/questions/23991852/how-do-i-hide-the-tabs-in-ionic-framework
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奶酪(张贺)
邮箱:
cheesezh@qq.com
出处:
http://www.cnblogs.com/CheeseZH/
*
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。