javascript - Why does this binding only work for the first three times I change the value? -
consider following snippet:
var items = ["item 1", "item 2"] window.app = ember.application.create(); window.app.applicationcontroller = ember.controller.extend({ sitems: items, svalue: items[0], slabel: ember.computed('svalue', function() { return this.get('svalue') == items[0] ? "you picked item 1!" : "you picked item 2!"; }) });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://builds.emberjs.com/tags/v1.13.5/ember.min.js"></script> <script src="http://builds.emberjs.com/release/ember-template-compiler.js"></script> <script type="text/x-handlebars"> {{view "select" content=sitems value=svalue}} {{slabel}} </script>
after changing value of <select>
3 times, no longer triggers changes svalue
property. consequently, label no longer changes.
i have been able reproduce in chrome , safari on os x, ie11 on windows 8.1, , firefox , chromium on linux. (you should able reproduce running snippet above.)
what doing wrong?
edit: appears a known bug introduced in ember.js v1.13.4.
i believe have encountered bug "ember.select stops updating value property after couple of option changes, introduced in 1.13.4"
Comments
Post a Comment