Hi - I’m having an issue with Ember.Select - when I set the Select’s value field to the models client property (which is a relationship to a Client model) - it seems to break. As in, I THINK it’s replacing the client value with NULL? I dunno.
This JSBin explains it all: http://jsbin.com/xoyaw/3/edit
Can anyone explain to me why the ‘client’ property is not getting properly populated (or overwritten) in the sample code?
Thx!
Looks like you need to define the client property on the index controller and bind the value of the select to the client, not the client.id.
App.IndexController = Ember.ObjectController.extend({
client: null
});
{{view Ember.Select
content=clients
optionLabelPath="content.name"
prompt="Select a Client"
value=client
class="form-control"}}
http://jsbin.com/tovaxesa/1/
Seems to do the trick.
Cheers
Just to provide an answer to my own question: http://jsbin.com/xoyaw/7/edit
Big thanks to a couple of guys on IRC chat!