ember.js - Ember.Select: Wrong selected value when content is set asynchronously -


here's problem in jsbin: http://emberjs.jsbin.com/bahuvusa/29/edit

when have select such this:

{{view ember.select   contentbinding="items"   optionvaluepath="content.value"   optionlabelpath="content.caption"   value=value }} 

where items set in route promisearray , data looks this:

[   {value: 1, caption: "one"},   {value: 2, caption: "two"},   {value: 3, caption: "three"} ] 

and have value set in controller:

value: function() {   return 2; }.property() 

when template renders see second element selected, instead value set undefined (see jsbin).

is there way make work? (without making elements ember-data model , using selectionbinding)

update

i ended using aftermodel hook , returning promise it: http://emberjs.jsbin.com/bahuvusa/40/edit

based on comments in post, took of code last comment in ticket github.com/emberjs/ember.js/issues/1333 , did small changes, how code looks now: http://emberjs.jsbin.com/bahuvusa/30/edit


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -