Ionic - How to remove sidemenu on login page only?

前端 未结 17 2627
北海茫月
北海茫月 2020-12-08 09:25

I need to remove sidemenu only on my login page. Otherwise remain. How it can be done? I\'m using command ionic ionic start myApp sidemenu to create the project

相关标签:
17条回答
  • 2020-12-08 09:54

    same issue here. just add hide-nav-bar="true" to the ion-view

    <ion-view hide-nav-bar="true">
    

    Hope it helps!

    0 讨论(0)
  • 2020-12-08 09:58

    I think the simplest solution in opening the login page in a modal view, checkout $ionicModal

    0 讨论(0)
  • 2020-12-08 10:00
    <ion-side-menus>
    

    bcn

                <ion-tab title="ALL" href="#/dashbord/all" class="bgorange">
                    <ion-nav-view name="all"></ion-nav-view>
                </ion-tab>
    
    
                <ion-tab title="INFO" class="bgorange" href="#/dashbord/info">
                    <ion-nav-view name="info"></ion-nav-view>
                </ion-tab>
    
                <ion-tab title="EVENTS" class="bgorange" href="#/dashbord/events">
                    <ion-nav-view name="events"></ion-nav-view>
                </ion-tab>
    
    
            </ion-tabs>
            <ion-nav-view></ion-nav-view>
    
        </ion-pane>
        <div ng-include src="calender.html"></div>
        <ion-side-menu side="left">
    
            <ion-content has-header="true">
                <ion-list>
    
                    <ion-item menu-close class="item-icon-left bottombordernone" href="#/dashbord">
                        <i class="icon ion-home"></i>
                        What's New
                    </ion-item>
                    <ion-item menu-close class="item-icon-left bottombordernone">
                        <i class="icon ion-chatbox-working"></i>
                        Feedback
                    </ion-item>
                    <ion-item menu-close class="item-icon-left bottombordernone" ng-click="logout()">
                        <i class="icon ion-power"></i>
                        Logout
                    </ion-item>
                </ion-list>
            </ion-content>
        </ion-side-menu>
    

    @Zulu here's my full code. I hope this Ex. work for you.

    0 讨论(0)
  • 2020-12-08 10:00
    .state('login', {
            url: '/login',
            controller: 'LoginCtrl',
            templateUrl: 'templates/loginpage.html'
        })
    .state('app.account', {
            url: '/account',
            views: {
                'menuContent': {
                    templateUrl: 'templates/account.html',
                    controller: 'AccountCtrl'
                }
            }
        })
    
    0 讨论(0)
  • 2020-12-08 10:03
    **Ionic 2**
    
    
        import { MenuController } from 'ionic-angular';
    
        export class LoginPage {
    
           constructor(public menuCtrl: MenuController) {
    
           }
    
           ionViewWillEnter() {
    
               this.menuCtrl.swipeEnable( false )
           }
    
           ionViewDidLeave() {
    
               this.menuCtrl.swipeEnable( true )
           }
        }
    
    
    
    IONIC 4: Sept2019
    try this code to in your login.page.ts
    Step1: import {  MenuController } from '@ionic/angular';
    Step2: constructor(public menuCtrl: MenuController) { }
    (below constructo)
    Step3: ionViewWillEnter() {
              this.menuCtrl.enable(false);
           }
           ionViewDidLeave() {
              this.menuCtrl.enable(true);
           } 
    
    this code will help you to work with side menu flawlessly on any screen, if you login & re-login and try it will work now. 
    
    0 讨论(0)
  • 2020-12-08 10:05

    Based on various answers here from everyone and 15 minutes of trying, here is my working example of it, and it should work as simply doing copy-paste

    Your view, like login.html

    <ion-view hide-nav-bar="true">
        <ion-header-bar class="bar-light title-image" align-title="center">
            <h1 class="title">Title</h1>
        </ion-header-bar>
        <ion-content>
        </ion-content>
    </ion-view>
    

    Your related controller, like LoginCtrl

    function LoginCtrl($scope, $ionicSideMenuDelegate) {
    
        $scope.$on('$ionicView.afterEnter', function(event) {
            $ionicSideMenuDelegate.canDragContent(false);
        });
        //enable side menu drag before moving to next view
        $scope.$on('$ionicView.beforeLeave', function(event) {
            $ionicSideMenuDelegate.canDragContent(true);
        });
    }
    
    0 讨论(0)
提交回复
热议问题