1.
<ion-tabs ng-class="{'tabs-item-hide':
$root.hideTabs}">
<!--
tabs -->
</ion-tabs>
2.
在该控制器下加上.directive:
var module = angular.module('app.directives', []);
module.directive('hideTabs', function($rootScope) {
return {
restrict: 'A',
link: function(scope, element, attributes) {
scope.$watch(attributes.hideTabs, function(value){
$rootScope.hideTabs = value;
});
scope.$on('$destroy', function() {
$rootScope.hideTabs = false;
});
}
};
});
3.
在html页面中引用hide-tabs
<ion-view title="New Entry Form" hide-tabs> <!-- view content --></ion-tabs>
本文详细介绍了如何在Angular应用中使用自定义指令来隐藏Tab,并通过控制器动态控制Tab的显示状态。包括了指令的定义、应用以及HTML模板中的引用。

被折叠的 条评论
为什么被折叠?



