Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Required validation does not work for multiple select and empty array #5304

Closed
romario333 opened this issue Dec 6, 2013 · 2 comments
Closed

Comments

@romario333
Copy link

Multiple select bound to model with ng-model and ng-options does not mark field as invalid if ng-model points to an empty array. Once you select and deselect value in select, validation starts to work as expected.

Here's the plunker demonstrating this issue.

Controller:

$scope.values = [
  {id: 1, name: 'one'},
  {id: 2, name: 'two'}
];
$scope.selectedValues = [];

HTML:

<select multiple 
  ng-required="true" 
  ng-model="selectedValues" 
  ng-options="value.name for value in values">
</select>
@romario333
Copy link
Author

Similar issue is here: #2365

@petebacondarwin
Copy link
Contributor

I have an easy fix for this. See #2365. Closing as a duplicate.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants