Heim > Fragen und Antworten > Hauptteil
.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;
})
});
}
};
})
目前是通过这个指令实现耳机目录的隐藏
ringa_lee2017-05-15 16:59:31
http://www.ithao123.cn/content-7470620.html
这个更强大,不用监听每个页beforeEnter,beforeLeave事件