You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
I need to temporarily store form input whether it is valid or not. I wanted to just store whole form model but the invalid fields were giving me some problems. I found that adding ng-model-options="{ allowInvalid: true }" should solve it. And it did for fields like input[email] or input[url], but not for the input[number]. http://jsfiddle.net/19kyru7k/
I would expect value in the last input to be printed whether or not it is valid if option allowInvalid is used. Should I consider this as a bug? Because if feels like it.
Tested using Angular 1.3.14 and 1.4.0-beta.6 in Chrome.
The text was updated successfully, but these errors were encountered:
I believe it has to do with how browsers handle number inputs (in regard ith their number contraint).
When you enter an invalid email into an input[type="email"], the field is marked as invalid, inp.value returns the (invalid) string you have entered. When you enter an invalid number (e.g. www) into an input[type="number"], the field is marked an invalid, but inp.value does not return the (invalid) value.
So, I don't think there is any way for Angular to determine what is the invalid value entered into a number field, in order to assign it to the model.
Note, that allowInvalid: true works as expected on number fields as far as other validation constraints are concerned (e.g. min/max etc).
I need to temporarily store form input whether it is valid or not. I wanted to just store whole form model but the invalid fields were giving me some problems. I found that adding ng-model-options="{ allowInvalid: true }" should solve it. And it did for fields like input[email] or input[url], but not for the input[number].
http://jsfiddle.net/19kyru7k/
I would expect value in the last input to be printed whether or not it is valid if option allowInvalid is used. Should I consider this as a bug? Because if feels like it.
Tested using Angular 1.3.14 and 1.4.0-beta.6 in Chrome.
The text was updated successfully, but these errors were encountered: