How to add and hide item in ionic?

628 Views Asked by At

i have a side-menu and i want to change the item of this side

eg: if user is connect ==> item my account is show

but if user is not connect ==>item my account is hide

in my controller:

facebookExample.controller("accueilController", function($scope, $cordovaOauth, $localStorage, $location,$ionicPopup,$state,$http) {

$scope.connect=true;
$localStorage.connect=true;

in the index.html :

<body ng-app="starter" ng-controller="accueilController" >
    <ion-item class="item" nav-clear menu-close href="#/login" ng-show="connect=='true'">
                             <i class="fa fa-user" style="padding-right: 190px;"></i> <div style="padding-left: 25px;padding-top: 5px;">My account  </div>                   
                            </ion-item>

i found nothing ,what can i do ,i use ng-if or ng-how and how ??

help me please

1

There are 1 best solutions below

2
On

Try removing that check in the ng-show

<body ng-app="starter" ng-controller="accueilController" >
<ion-item class="item" nav-clear menu-close href="#/login" ng-show="connect">
  <i class="fa fa-user" style="padding-right: 190px;"></i>
  <div style="padding-left: 25px;padding-top: 5px;">My account</div>                   
</ion-item>