Ionic hiding tabs method, ionic hiding tabs Method
This article shares with you the ionic hidden tabs Method for your reference. The specific content is as follows:
1.
<ion-tabs ng-class="{'tabs-item-hide': $root.hideTabs}"><!-- tabs --></ion-tabs>
2.
Add. directive under the controller:
var module = angular.module('app.directives', []);module.directive('showTabs', function ($rootScope) { return { restrict: 'A', link: function ($scope, $el) { $rootScope.hideTabs = false; } };}).directive('hideTabs', function ($rootScope) { return { restrict: 'A', link: function ($scope, $el) { $rootScope.hideTabs = true; } };})
3.
Reference hide-tabs on the html page
<ion-view title="New Entry Form" hide-tabs> <!-- view content --></ion-tabs>
4.
When the page returns to the home page, you need to display tabs again, you need to add in the Controller (mainly to solve the problem of tabs or hidden on android ):
$ Scope. $ on ('$ ionicView. enter', function () {// display tabs $ rootScope. hideTabs = false ;});
5.
I used tabs-top and encountered another problem: some content of <ion-content> will be hidden. solution:
Modify the content in directive. js again and stop using showTabs:
.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; }); } };})
To sum up, compared with the tabs usage, if it is at the bottom, there will be no major problems above. However, if it is used on the top, it involves content and may encounter some problems.
In fact, you can consider using <ion-slide> on ionic to replace <ion-tabs>, whether it is sliding with other pages or slide pages, it will be greatly improved, especially on android.
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.