mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
fix(input): keep track of min/max attars on-the-fly
Now input[type=button] keeps track of both min and max attrs even if they change over time.
This commit is contained in:
committed by
Matias Niemelä
parent
269bc7e51f
commit
4b653aeac1
@@ -544,8 +544,8 @@ function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
|
||||
});
|
||||
|
||||
if (attr.min) {
|
||||
var min = parseFloat(attr.min);
|
||||
var minValidator = function(value) {
|
||||
var min = parseFloat(attr.min);
|
||||
if (!ctrl.$isEmpty(value) && value < min) {
|
||||
ctrl.$setValidity('min', false);
|
||||
return undefined;
|
||||
@@ -560,8 +560,8 @@ function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
|
||||
}
|
||||
|
||||
if (attr.max) {
|
||||
var max = parseFloat(attr.max);
|
||||
var maxValidator = function(value) {
|
||||
var max = parseFloat(attr.max);
|
||||
if (!ctrl.$isEmpty(value) && value > max) {
|
||||
ctrl.$setValidity('max', false);
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user