angular / angular.js

AngularJS - HTML enhanced for web apps!
https://angularjs.org
MIT License
58.81k stars 27.49k forks source link

Select options won't update after changing scope's variable #9025

Closed beefs closed 10 years ago

beefs commented 10 years ago

Hi, Select wont update it's options since 1.2.22 when we change the the scope variable.

example: 1.2.21: http://jsfiddle.net/uLdmH/33/ 1.2.22: http://jsfiddle.net/uLdmH/34/

Thanks.

mluiten commented 10 years ago

I'm experiencing the same issue. I think it's due to a optimization in the rendering of the select directive in v1.2.22. It's now watching changes in the given options, but not changes in the labels (or values or anything else for that matter).

Not sure if this was an unintended feature, but we've come to rely on it for pluralizing options based on the value of a model. So I'm hoping we can at least retain this features for labels.

I'll submit a patch shortly.

gkalpak commented 10 years ago

Just verifying that it is also an issue for 1.3.0-rc.1: http://jsfiddle.net/ExpertSystem/uLdmH/35/

btford commented 10 years ago

@mluiten – FYI you should submit PRs against master in the future. We cherry-pick PRs to the stable branch.

Your change also needs a test.

wilgert commented 10 years ago

The commit that fixed this causes problems in our application. On a certain form we have several text fields and 1 select field containing 248 options (it's a country selector).

Since this commit: https://github.com/angular/angular.js/commit/46274102454038ee7fd4543a32166e9bbbc98904 entering data in any field of the form has become very slow on fast computers with Chrome and near impossible on slower computers and Internet Explorer (other browsers not tested yet).

By slow I mean that letters appear between several 100 milliseconds and several seconds after a keystroke.

Is there anything I can do about this or is the code in this commit should be improved because it is sub-optimal?