Reputation: 261
How do you disable the drag function on an ionic side menu? I am pretty new to this and need help. When I swipe right on the main page... it opens up a menu and I don't want this to happen. Here is my current code:
<!-- Side menu -->
<ion-side-menu side="left" drag-content="false">
<ion-header-bar class="bar-dark">
<h1 class="title">Cards</h1>
</ion-header-bar>
<ion-content scroll="true">
</ion-side-menus>
Javascript:
$scope.$root.canDrag = false;
Upvotes: 3
Views: 11066
Reputation: 4204
You can disable drag side menu, for example on login page where you don't want side menu to be visible.
(function () {
'use strict';
angular
.module('myApp')
.controller('LoginCtrl', [
'$scope',
'$log',
'$ionicSideMenuDelegate',
LoginFunction]);
function LoginFunction($scope, $log, $ionicSideMenuDelegate) {
var vm = this;
$log.debug('its working');
$ionicSideMenuDelegate.canDragContent(false)
}
}());
Upvotes: 1
Reputation: 4477
Drag-content attribute must be written over tag.
For e.g :
<ion-side-menu side="left">
<ion-pane ion-side-menu-content drag-content="false">
<ion-header-bar class="bar-dark">
<h1 class="title">Cards</h1>
</ion-header-bar>
<ion-content scroll="true">
</ion-content>
</ion-pane>
</ion-side-menus>
This will do the job. !!
Edit :
To Create a Menu Close Button, add the attribute menu-toggle="menu_side" to the button.
E.g
<button menu-toggle="right" class="button transparent button-icon icon ion-navicon"></button>
Upvotes: 8