1.指令代码
1 directiveMod.directive('hideTabs',function($rootScope){ 2 return { 3 restrict:'AE', 4 link:function($scope){ 5 $scope.$on('$ionicView.beforeEnter', function() { 6 $rootScope.hideTabs = 'tabs-item-hide'; 7 8 console.log('tabs-item-hide'); 9 10 });11 $scope.$on('$destroy',function(){12 $rootScope.hideTabs = '';13 console.log('no-tabs-item-hide');14 15 })16 }17 } })
2.使用示例:
app.js
angular.module('starter', ['ionic','starter.controllers','starter.directive'])
tabs.html
12
12 ......3