Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何仅在指令的拖动端触发ng更改?_Angularjs - Fatal编程技术网

Angularjs 如何仅在指令的拖动端触发ng更改?

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,

这可能是一个简单的修复,但我想做的是只在拖动端触发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, 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);
            })
        }
    }
}])