0

I have an angular app in which I have a directive that wraps jquery slider and then there is an input field (type text) in which user can type a number (directive for taking only numbers is setup). This input field and slider share the same model.

Is there a way to restrict the user to not type more than lets say, 30, since, my slider's max value is 30?

Input field takes only two digits and now it should not go beyond 30 value. Do I have to write a directive for per-digit validation or that can be done in controller? Appreciate your help.

www.jsfiddle.net/6vkdw

(This contains directives I used for numbers and slider)

4

1 回答 1

0

我找到了解决方案: $scope.$watch('transaction1', function(){ if($scope.transaction1 > 30){ $scope.transaction1 = 30; } }); 我想我的绑定不正确。

于 2013-10-24T22:22:38.653 回答