mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
No more errors on side menu ctrl
This commit is contained in:
@ -6,7 +6,48 @@ angular.module('ionic.ui', [])
|
|||||||
angular.extend(this, SideMenuController.prototype);
|
angular.extend(this, SideMenuController.prototype);
|
||||||
|
|
||||||
SideMenuController.call(this, {
|
SideMenuController.call(this, {
|
||||||
|
left: {
|
||||||
|
width: 270,
|
||||||
|
pushDown: function() {
|
||||||
|
},
|
||||||
|
bringUp: function() {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
width: 270,
|
||||||
|
pushDown: function() {
|
||||||
|
},
|
||||||
|
bringUp: function() {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
onDrag: function(e) {},
|
||||||
|
endDrag: function(e) {},
|
||||||
|
getTranslateX: function() {
|
||||||
|
/*
|
||||||
|
var r = /translate3d\((-?.+)px/;
|
||||||
|
var d = r.exec(this.el.style.webkitTransform);
|
||||||
|
|
||||||
|
if(d && d.length > 0) {
|
||||||
|
return parseFloat(d[1]);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
return $scope.contentTranslateX || 0;
|
||||||
|
},
|
||||||
|
setTranslateX: function(amount) {
|
||||||
|
//this.el.style.webkitTransform = 'translate3d(' + amount + 'px, 0, 0)';
|
||||||
|
$scope.contentTranslateX = amount;
|
||||||
|
},
|
||||||
|
enableAnimation: function() {
|
||||||
|
//this.el.classList.add(this.animateClass);
|
||||||
|
},
|
||||||
|
disableAnimation: function() {
|
||||||
|
//this.el.classList.remove(this.animateClass);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$scope.contentTranslateX = 0;
|
||||||
})
|
})
|
||||||
|
|
||||||
.directive('sideMenuController', function() {
|
.directive('sideMenuController', function() {
|
||||||
@ -23,8 +64,8 @@ angular.module('ionic.ui', [])
|
|||||||
return {
|
return {
|
||||||
restrict: 'CA',
|
restrict: 'CA',
|
||||||
require: '^sideMenuController',
|
require: '^sideMenuController',
|
||||||
compile: function(element, attr, transclude, sideMenuCtrl) {
|
compile: function(element, attr, transclude) {
|
||||||
return function($scope, $element, $attr) {
|
return function($scope, $element, $attr, sideMenuCtrl) {
|
||||||
window.ionic.onGesture('drag', function(e) {
|
window.ionic.onGesture('drag', function(e) {
|
||||||
sideMenuCtrl._handleDrag(e);
|
sideMenuCtrl._handleDrag(e);
|
||||||
}, $element[0]);
|
}, $element[0]);
|
||||||
@ -33,6 +74,9 @@ angular.module('ionic.ui', [])
|
|||||||
sideMenuCtrl._endDrag(e);
|
sideMenuCtrl._endDrag(e);
|
||||||
}, $element[0]);
|
}, $element[0]);
|
||||||
|
|
||||||
|
$scope.$watch('contentTranslateX', function(value) {
|
||||||
|
console.log('Translate X changing', value);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user