jpkleemans / angular-validate

Painless form validation for AngularJS. Powered by the jQuery Validation Plugin.
MIT License
68 stars 33 forks source link

Select ng-model issue #21

Closed Cristiian closed 7 years ago

Cristiian commented 7 years ago

Hello, I got working this wrapper in my application, but I found out that when you set a ng-model value in a select, the validation just stops working, I don't know if this is an angular issue or the wrapper, or jquery validate.

JSFiddle example

jpkleemans commented 7 years ago

In your example user is undefined, so angular generates the following <option> in your <select>:

<option value="? undefined:undefined ?" selected="selected"></option>

jQuery Validate thinks this is valid, because "? undefined:undefined ?" is a valid 'required' value. Only if the value is not set (value=""), the validator will mark it as invalid.