Angularjs 如何仅在指令的拖动端触发ng更改?
这可能是一个简单的修复,但我想做的是只在拖动端触发ng更改 在我直接从HTML执行此操作之前:Angularjs 如何仅在指令的拖动端触发ng更改?,angularjs,Angularjs,这可能是一个简单的修复,但我想做的是只在拖动端触发ng更改 在我直接从HTML执行此操作之前: <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,
<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更改
谢谢。我只是在指令中注入了服务:
'use strict';
angular.module('image.directives').directive('testDragEnd', function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.on('$md.dragend', function() {
console.info('Drag Ended');
})
}
}
})
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);
})
}
}
}])