1.
<ion-tabs ng-class="{‘tabs-item-hide‘: $root.hideTabs}" class="tabs-icon-only">
<!-- 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>
时间: 2024-10-13 14:19:44