Thanks so much for explaining this! I assumed that Angular was taking over
the validation for type="number" rather than relying on the browser. I like
your suggestion to prevent invalid entry by using ng-pattern. Another
option is to limit the keystrokes accepted. I have written a simple
"digits-only" directive that does that.


On Sun, Feb 16, 2014 at 12:48 PM, Daniel Tabuenca <[email protected]>wrote:

> The fundamental issue is that some browsers will return an empty string
> when a numeric input type has invalid data, therefore angular will only see
> an empty string and consider the element valid.
>
> The sample you posted works in firefox for me, but not in chrome.
>
> Some workarounds would be to not use a numeric-input type and then provide
> your own regular expression to validate (thus circumventing the browser's
> own checking).
>
> Another fix might be to use a mask to prevent them from typing in
> non-numeric text into the input to begin with.
>
>
>  --
> 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.
>



-- 
R. Mark Volkmann
Object Computing, Inc.

-- 
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