Ionic - How to remove sidemenu on login page only?

前端 未结 17 2852
北海茫月
北海茫月 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 10:18

    Calling $ionicSideMenuDelegate.canDragContent(false) does disable the ability to swipe to access the menu, but does not hide the hamburger toggle button in the navbar (if you have one). To do that, you can use ng-show with $root binding in your ion-side-menu-content element like this:

      
        
      
    

    Then in your login controller:

    $scope.$on('$ionicView.beforeEnter', function (event) {
      $scope.$root.showMenuIcon = false;
      $ionicSideMenuDelegate.canDragContent(false);
    });
    
    $scope.$on('$ionicView.beforeLeave', function (event) {
      $scope.$root.showMenuIcon = true;
      $ionicSideMenuDelegate.canDragContent(true);
    });
    

提交回复
热议问题