If I use a input type=number with min or max restrictions, then AngularJS, 
just sets a boolean field <form>.<field>.$error.min = true
That means to show the actual min/max values I have to have them twice in 
the code, like this: http://plnkr.co/edit/KfFwfaVncAIvKFwVOEHP?p=preview
Notice how there are two occurrences of "3" (min) and "10" (max) (one in 
the min/max attribute and one in the actual error text).

That prevents me from writing a directive that shows all validation errors 
and at the same time shows the actual min/max values to the user.

How about ng setting not just a boolean, but an object with the "validation 
parameter", like <form>.<field>.$error.min = { min: 3} ?
This would still work with code that just checks for a truthy value.
For even more code compatibility (if somebody really did something like 
"ng-show='form.field.error.min === true' ", ng could also
set both "<form>.<field>.$error.min = true" and 
"<form>.<field>.$error.minValue = 3"

What do you think? Is there already a better way?
Is a patch for either variant welcome?

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to