angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

select + ng:options does not show all options

Open vojtajina opened this issue 15 years ago • 4 comments

When changing the number of options available in a select which uses ng:options all options are not always visible.

See http://jsfiddle.net/pzwQY/6/ for an example. Change from "colors" to "pets" and back to "colors", the second select will now only show 2 of the 4 colors.

This can also be seen on your example of ng:options at http://docs.angularjs.org/#!/api/angular.directive.ng:options. Remove an option and a new one. The last option will not be visible.

vojtajina avatar Jul 08 '11 17:07 vojtajina

Unless I am misunderstanding the issue, this works as intended. See http://jsfiddle.net/HucLQ/

  1. select colors and red and notice that the value=red
  2. change colors to pets, and notice that value=red (no change as expected) but the ng:option does not have red in its list, so it resorts do displaying blank.

This is the intended behavior.

mhevery avatar Jul 10 '11 04:07 mhevery

Try this:

  • open http://jsfiddle.net/HucLQ/
  • check the second select options: red, green, blue, purple
  • change the first select to "pets"
  • check the second select options: cat, dog
  • change the first select back to "colors"
  • check the second select options: red, green (there are only first 2 options displayed) !!!

vojtajina avatar Jul 10 '11 08:07 vojtajina

I think it does look a bit buggy when the last two options just disappears after switching back to colors from pet

Codier avatar Jul 11 '11 15:07 Codier

I understand now. Please include better repro steps next time. :-)

mhevery avatar Jul 11 '11 19:07 mhevery