.directive('hideTabs', function($rootScope) {
return {
restrict: 'A',
link: function(scope, element, attributes) {
scope.$on('$ionicView.beforeEnter', function() {
scope.$watch(attributes.hideTabs, function(value){
$rootScope.hideTabs = 'tabs-item-hide';
});
});
scope.$on('$ionicView.beforeLeave', function() {
scope.$watch(attributes.hideTabs, function(value){
$rootScope.hideTabs = 'tabs-item-hide';
});
scope.$watch('$destroy',function(){
$rootScope.hideTabs = false;
})
});
}
};
})
目前是透過這個指令實現耳機目錄的隱藏
http://www.ithao123.cn/content-7470620.html
這個更強大,不用監聽每個頁beforeEnter,beforeLeave事件