diff --git a/js/angular/controller/sideMenuController.js b/js/angular/controller/sideMenuController.js index 6a120259d..58a77a77c 100644 --- a/js/angular/controller/sideMenuController.js +++ b/js/angular/controller/sideMenuController.js @@ -329,6 +329,10 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io // Handle a drag event self._handleDrag = function(e) { if (isAsideExposed || !$scope.dragContent) return; + //if dragContent is right + if ($scope.dragContent=='right' && !self.isOpenRight() && e.gesture.direction=='right')return; + //if dragContent is left + if ($scope.dragContent=='left' && !self.isOpenLeft() && e.gesture.direction=='left')return; // If we don't have start coords, grab and store them if (!startX) { @@ -359,7 +363,7 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io self.canDragContent = function(canDrag) { if (arguments.length) { - $scope.dragContent = !!canDrag; + $scope.dragContent = canDrag; } return $scope.dragContent; }; diff --git a/js/angular/directive/sideMenu.js b/js/angular/directive/sideMenu.js index 1ab736794..9f124a355 100644 --- a/js/angular/directive/sideMenu.js +++ b/js/angular/directive/sideMenu.js @@ -28,21 +28,28 @@ IonicModule return { restrict: 'E', require: '^ionSideMenus', - scope: true, + scope: {side:'@?'}, compile: function(element, attr) { angular.isUndefined(attr.isEnabled) && attr.$set('isEnabled', 'true'); angular.isUndefined(attr.width) && attr.$set('width', '275'); - element.addClass('menu menu-' + attr.side); return function($scope, $element, $attr, sideMenuCtrl) { - $scope.side = $attr.side || 'left'; - + $scope.side = $scope.side || 'left'; var sideMenu = sideMenuCtrl[$scope.side] = new ionic.views.SideMenu({ width: attr.width, el: $element[0], isEnabled: true }); + $scope.$watch('side',function (value) { + element.removeClass('menu-right menu-left'); + element.addClass('menu menu-' + $scope.side); + sideMenu = sideMenuCtrl[$scope.side] = new ionic.views.SideMenu({ + width: attr.width, + el: $element[0], + isEnabled: true + }); + }) $scope.$watch($attr.width, function(val) { var numberVal = +val; @@ -57,4 +64,3 @@ IonicModule } }; }); - diff --git a/js/angular/directive/sideMenuContent.js b/js/angular/directive/sideMenuContent.js index f7827b58b..5223cc4c2 100644 --- a/js/angular/directive/sideMenuContent.js +++ b/js/angular/directive/sideMenuContent.js @@ -36,7 +36,9 @@ function($timeout, $ionicGesture, $window) { return { restrict: 'EA', //DEPRECATED 'A' require: '^ionSideMenus', - scope: true, + scope: { + dragContent:"@?" + }, compile: function(element, attr) { element.addClass('menu-content pane'); @@ -46,7 +48,7 @@ function($timeout, $ionicGesture, $window) { var primaryScrollAxis = null; if (isDefined(attr.dragContent)) { - $scope.$watch(attr.dragContent, function(value) { + $scope.$watch('dragContent', function(value) { sideMenuCtrl.canDragContent(value); }); } else { diff --git a/package.json b/package.json index e6e2c40e8..0de0ae677 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,9 @@ "repository": { "url": "git://github.com/ionic-team/ionic.git" }, + "scripts":{ + "gulp":"gulp" + }, "devDependencies": { "canonical-path": "0.0.2", "chalk": "^0.4.0",