Ionic sidemenu change


#1

Good day all, i have problem.
i use $ ionic start myApp sidemenu.
Push button login on sidemenu, how after login change sidemenu? del login button?
Template menu:\www\templates\menu.html
I think i can change template or no? help me pls)
Pic


#2

You could set the menu items in a div, then apply ng-show or ng-if. But you must set certain conditions in the controller.js. For example if user is logged in, ng-show="!loggedIn == true" for the login button and ng-show=“loggedIn == true” for the logout button. Hope it helps!


#3

Take a look at the TrendCity demo app (from the book ‘Developing an Ionic Edge’) on GitHub: https://github.com/trendicity/trendicity/blob/master/www/templates/menu.html

    ...

    <ion-item menu-close class="item-icon-left" ng-click="login()" ng-hide="isLoggedIn()">
        <i class="icon ion-log-in"></i>
        Login
    </ion-item>
    <ion-item menu-close class="item-icon-left" ng-click="logout()" ng-show="isLoggedIn()">
        <i class="icon ion-log-out"></i>
        Logout
    </ion-item>

    ...

and: http://robferguson.org/2015/07/19/using-ui-router-for-handling-routes-defining-states-and-sharing-data-between-views/