How do I hide the tabs in Ionic Framework

后端 未结 10 659
囚心锁ツ
囚心锁ツ 2020-12-08 07:44

I chose the ionic tab view so I can use the templating system but I can\'t remove the tabs. I want a view like this and I did manage to remove the header bar but I cant remo

10条回答
  •  清歌不尽
    2020-12-08 07:58

    I used dotfrank's answer and it worked like a charm, except for when I went a few layers deep in a specific tab's view and then used the back button. Going back to a view that has the directive "hideTabs = 'true'" will actually have it set to "false" unless you wrap the $watch on hideTabs in the $ionicView.beforeEnter event.

    .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 = value;
                    });
                });
    
                scope.$on('$ionicView.beforeLeave', function() {
                    $rootScope.hideTabs = false;
                });
            }
        };
    });
    

    Hope this helps! (also, this is my first answer... so if I'm completely missing something, then forgive my noobness).

提交回复
热议问题