问题
In this example: http://jsfiddle.net/5WrcD/2/ I have two Ember.Select
s with selection
bound to a single controller. Using Firefox (I'm running version 15.0 Mac), when I change the value of the first select
, the second select
does not change. If I then proceed to change the value of the second select
to match the first, all subsequent changes to either select
will be propagated to the other. Using Chrome/Safari the select
s stay synchronized from the beginning.
Could this possible be a bug in Ember or Firefox? Am I wrong to expect the select
s to stay synchronized?
回答1:
This is probably not a bug with Ember, but an issue with Firefox I guess.
If you check with a DOM inspector(Firebug) in Firefox you can see that the correct options are getting selected, the two select menus are changing synchronously. Its just that its not being shown in display until we change a couple of times.
So Ember
is anyway successful in setting selected="selected"
on the correct option
, Firefox is having problems showing the correct item in ui.
I created another ticket here for the issue:
HTML select, correct option selected in DOM, but wrong item shown in firefox
Update
After discussions on the other Question, it is found that setting content:''
will fix the issue in firefox. So if you dont want any default selection you are good to go without this.
Eg : http://jsfiddle.net/5WrcD/3/show/
Credits : vol7ron
来源:https://stackoverflow.com/questions/12219587/multiple-ember-selects-bound-to-a-single-controller-selects-do-not-synchronize