I am trying to make an application using ionic tabs and using this code as the foundation:
However, I prefer to keep the ion-tabs only for the first state of each tab and not for the subsequent states (just like the flipboard app). Basically resulting in something like this:
If you want to hide the tabs bar when you go, for example, on a detail view, you can simply define your detail view without be a child of the tabs bar.
or use ui-sref (because its more powerfull with states i think )
ui-sref="navstack"
Under the hood you define the detail view (the navstack in this case) to be an simple view without the abstract parent state âtabâ. So when you go on the about tab and click on the button âtabs nav stackâ you have the view without the tabs bar.
From my experience the navigation history still work correctly but when you pass from tabs views to detail views the history start a new one. So if you go from a detail view to another detail view, you will have the back button for navigating. If you want a back button for going back from the first detail view to the main tabs view, you must inject manualy a nav back button, this is the default of this tehcnique.
I do the same thing for a project. I have use a ng-class on the tab bar. I created a css class hideTabBar, and then apply it on the detail viewa. In order for this to work, you have to do this in your app.js where you usually will find your app.run(). Yiu will need to inject $rootScope and $location. Then use $rootScope.on (â$ionViewBeforeEnterâ) then apply the class for the necessary routes inside of that using $rootScope.hideTabBar = true;
You will still maintain navigation history as you are only hiding the tab bar rather than removing it. So just keep your tab name in your route as you had it originally.
Thanks to all who replied.
Although these options work pretty well but Iâve found another one which seems easier to understand and implement. Instead of using ng-class or ng-show and injecting $rootscope and $location, we can make use of Ionicâs âhiddenâ option on each ion-tab like this:
the variable âObject.hiddenâ can be initiated by a boolean âfalseâ in the tabs controller and can be modified by subsequent child controllers, which by default, share the parent scope.