【发布时间】:2016-05-13 09:22:43
【问题描述】:
这里是使用 jquery UI 的 angularJS 指令。我想在 resize 函数中设置可以调整大小的元素的最大宽度。这怎么可能?
app.directive('resizable', function () {
return {
restrict: 'A',
scope: {
callback: '&onResize'
},
link: function postLink(scope, elem, attrs) {
elem.resizable({ grid:200, handles: 'e,w'});
elem.on('resize', function (evt, ui) {
scope.$apply(function() {
if (scope.callback) {
scope.callback({$evt: evt, $ui: ui });
//here is where I want to set maximum width
}
})
});
}
};
});
【问题讨论】:
标签: javascript jquery angularjs angularjs-directive