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

ngOptions with boolean values breakes select element #3490

Closed
pastorcak opened this issue Aug 7, 2013 · 5 comments
Closed

ngOptions with boolean values breakes select element #3490

pastorcak opened this issue Aug 7, 2013 · 5 comments

Comments

@pastorcak
Copy link

I have this array for ngOptions:
$scope.boolValues = [{value: true, name: 'True'}, {value: false, name: 'False'}];

and this ng-options in html:
ng-options="bool.value as bool.name for bool in boolValues"

When I try to select "False" in select element new empty options is created and selected. When I try to select "True", empty option is removed and correct option is selected.
I think ngOption directive is not prepared for boolean values...

@lgalfaso
Copy link
Contributor

I am not able to reproduce this issue with the 1.1.5 nor 1.0.7
http://jsfiddle.net/3FJPB/1/
If there is more that needs to be looked at, please post a fiddle

@pkozlowski-opensource
Copy link
Member

@lgalfaso is right (thnx once again!), seems to be working OK in a jsfiddle.
@pastorcak closing for now, please provide live reproduce scenario if you've got different use-case.

@romario333
Copy link

To reproduce the issue add the required attribute to the select:

http://jsfiddle.net/3FJPB/2/

@PowerKiKi
Copy link
Contributor

This issue is a duplicate of #2594 and I think neither of them should be closed as long as the PR is not merged.

@petebacondarwin
Copy link
Member

I don't think that having duplicate issues open will help get this fixed. The two issue reference each other and a fix should ensure that both are working. If you wanted to help you could provide a PR that has unit tests for select that "fail" currently without a fix. Any fix can then be tested againss this.

lgalfaso added a commit to lgalfaso/angular.js that referenced this issue Sep 24, 2013
Make the `required` directive accept the model value `false` when it is
not an <input> element or when the <input> element is not a checkbox

Closes angular#3490 angular#2594
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Sep 25, 2013
`checkboxInputType` and `ngList` directives need to have special logic for whether
they are empty or not.  Previously this had been hard coded into their
own directives or the `ngRequired` directive.  This made it difficult to handle
these special cases.

This change factors out the question of whether an input is empty into a method
`$isEmpty` on the `ngModelController`.  The `ngRequired` directive now uses this
method when testing for validity and directives, such as `checkbox` or `ngList`
can override it to apply logic specific to their needs.

Closes angular#3490, angular#3658, angular#2594
vojtajina pushed a commit to vojtajina/angular.js that referenced this issue Oct 7, 2013
`checkboxInputType` and `ngList` directives need to have special logic for whether
they are empty or not.  Previously this had been hard coded into their
own directives or the `ngRequired` directive.  This made it difficult to handle
these special cases.

This change factors out the question of whether an input is empty into a method
`$isEmpty` on the `ngModelController`.  The `ngRequired` directive now uses this
method when testing for validity and directives, such as `checkbox` or `ngList`
can override it to apply logic specific to their needs.

Closes angular#3490, angular#3658, angular#2594
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
`checkboxInputType` and `ngList` directives need to have special logic for whether
they are empty or not.  Previously this had been hard coded into their
own directives or the `ngRequired` directive.  This made it difficult to handle
these special cases.

This change factors out the question of whether an input is empty into a method
`$isEmpty` on the `ngModelController`.  The `ngRequired` directive now uses this
method when testing for validity and directives, such as `checkbox` or `ngList`
can override it to apply logic specific to their needs.

Closes angular#3490, angular#3658, angular#2594
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
`checkboxInputType` and `ngList` directives need to have special logic for whether
they are empty or not.  Previously this had been hard coded into their
own directives or the `ngRequired` directive.  This made it difficult to handle
these special cases.

This change factors out the question of whether an input is empty into a method
`$isEmpty` on the `ngModelController`.  The `ngRequired` directive now uses this
method when testing for validity and directives, such as `checkbox` or `ngList`
can override it to apply logic specific to their needs.

Closes angular#3490, angular#3658, angular#2594
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
6 participants