angular-auto-validate
angular-auto-validate copied to clipboard
Number validation not showing when also required
I just ran across an issue - and I'm not sure if it's an angular issue or angular-auto-validate. I have an <input type="number" required />
and I seem to always be getting the required error validation message even i've typed something (non-numeric) into the input. I am expecting the error message to be the number error message, not the required message.
The angular demo on https://docs.angularjs.org/api/ng/input/input%5Bnumber%5D seems to work as expected with required and number.
Thoughts?
Hmmm, most likely if you put a non-numeric into the field the formatter in angular is failing so the model is not updating so it appears to auto-validate that the field has not got anything in. I'll investigate.
Thanks. I found a workaround by creating a directive allow-invalid
which always returns ngModelCtrl.$viewValue
from $parsers.push
that seems to put the invalid value on the model but it's kind of a hack. The only reason I believe this could be auto-validate issue is because it is behaving as expected on the above example in the angular documentation.
Yeah this is a problem with the library specifically the debounce function on the ngModelDecorator. Both the number and required validation errors are coming through but required is get picked over number. Need to thing about handling this.
Any movement on this?
Sorry I did look at this but haven't figure out a fix yet.
Any fix for this please?
Sorry I completely forgot about this bug - I'll take a look