我正在尝试使用Ember.Select控件在模型上设置关联id。但是,我似乎无法让控件将其选择绑定到id属性,而不是整个模型对象。这是在Ember.Select控件中设计的吗?我的模板中有以下内容:
{{view Ember.Select
contentBinding="App.peopleController.content"
selectionBinding="App.selectedPersonController.personId"
optionLabelPath="content.fullName"
optionValuePath="content.id"}}但是,即使显式地将selectionBinding设置为personId属性,它似乎仍然绑定到person对象。完整的jsfiddle在这里:http://jsfiddle.net/PXVZb/10/
发布于 2012-03-11 17:04:47
我建议将所选的person绑定到您的App.selectedPersonController,并创建一个绑定到person id的属性personId,请参阅http://jsfiddle.net/PXVZb/11/
JS:
App.selectedPersonController = Ember.Object.create({
personIdBinding: 'person.id'
});车把:
{{view Ember.Select
contentBinding="App.peopleController.content"
selectionBinding="App.selectedPersonController.person"
optionLabelPath="content.fullName" }}https://stackoverflow.com/questions/9649976
复制相似问题