这可能是一个简单的修复,但我想要做的只是在拖拽端触发ng-change。
在我直接从HTML开始之前:
pickle.dump(module.ObjectFromModule(), open('C:\object\location\obj.p', 'wb'))
值来自ng-repeat。
为了检测dragend,我创建了这个指令:
<md-slider aria-label="{{ key }}" step="{{ value.step ? value.step : 1 }}" ng-model="filters.lastAppliedFilter.options[key].current" ng-change="filters.applyValue(filters.lastAppliedFilter.name, key, filters.lastAppliedFilter.options[key].current)" min="{{ value.min ? value.min : 1 }}" max="{{ value.max ? value.max : 250 }}"></md-slider>
我的问题是如何才能在拖拽结束时触发ng-change?
感谢。
答案 0 :(得分:0)
我只是在指令中注入了服务:
angular.module('image.directives').directive('testDragEnd', ['filters', function(filters) {
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.on('$md.dragend', function() {
var key = attrs.ariaLabel;
filters.applyValue(filters.lastAppliedFilter.name, key, filters.lastAppliedFilter.options[key].current);
})
}
}
}])