我有这样的输入 slider
<input ng-model="value" type="text" id="mySlider1" slider ng-change="fun()"/>
此 slider 的值从 1 到 10
我需要通过 ng-model 获取这个值并使用 angularjs Controller 执行 fun() 当改变 slider 时。
AngularJS Controller
$scope.fun = function () {
console.log($scope.value)
};
最佳答案
您可以像这样在模型上放置一个观察者 -
$scope.$watch("value", function(){
// do whatever you need with the just-changed $scope.value
});
关于javascript - 带有 ng-change 的 Angularjs slider ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29033594/