Hide a ion-tab


I’m currently trying to make a tab app using ionic.
I want to hide a tab based on a variable inside a controller.

I saw the hidden property and set it to an hardcoded true and it works, however It doesn’t work when trying to use the controller variable. Same with the angular ng-hide and ng-show attributes.

my code :
My controller :

.controller('AuthCtrl', function($scope) {
	$scope.isLoggedIn = true;

my html file :

<ion-tabs ng-controller="AuthCtrl as auth" class="tabs-icon-top tabs-color-active-positive" >
  <ion-tab  title="Login" icon-off="ion-gear-a" icon-on="ion-gear-a" href="#/tab/login" ng-hide="isLoggedIn" hidden="isLoggedIn">
    <ion-nav-view  name="tab-login" ></ion-nav-view>

Note : the display of the var is correct and show true.
Can you see what my problem is ?

Thank you.


I found the solution.
Instead of using hidden, ng-show or ng-hide I can use ng-if will hide the tab.


1 Like

Hello @vbastien, I am new in IONIC. I am developing an app that has login and signup pages. After login, i want to show tabs. But in Login page, i want to hide tab. So, I read your post.can you please describe your code.Especially HTML file.

Thank you:slight_smile:

You can hide it in the controller.
for example if it’s named LoginController:
.controller('LoginController', function($scope, $ionicTabsDelegate) {