I want to change content of side menu when a user is logged in.
Example 1 - user not logged in:
This side menu is shown when a user isn't logged in.
Example 2 - user is logged in:
As you can see, there are a couple of extra menu items. These are only shown when a user is logged in.
in my controller:
$http.get('http://127.0.0.1:8080/elodieService/consommateurs/'+$localStorage.idconsommateur, { params: { "idconsommateur":$localStorage.idconsommateur, fields: "nom,prenom",format:"json"} }).then(function(result) {
console.log(JSON.stringify(result.data));
$scope.prenomconsommateurConnect=result.data.prenom;
in the view :
<ion-header-bar class="bar-stable" >
<h1 class="title" ng-hide="!prenomconsommateurConnect" ng-controller="accueilController">Bonjour Hello {{prenomconsommateurConnect}}</h1>
<h1 class="title" ng-hide="prenomconsommateurConnect" ng-controller="accueilController">Bonjour Hello link</h1>
</ion-header-bar>
but i found always this result "bonjour hello link" what can i do please??
What can I do? Should I use ng-if
, ng-show
or ng-hide
?
Or is there another/better solution for this case?
Any help is appreciated.
you can put ng-if OR ng-show and ng-hide.. i have used ng-if..!
in menu controller:
menu.html
hope this helped you.