我正在尝试使用Ember.Select控件在模型上设置关联ID.但是,我似乎无法将控件的选择绑定到id属性而不是整个模型对象.这是Ember.Select控件中的设计吗?我的模板中有以下内容:
{{view Ember.Select
contentBinding="App.peopleController.content"
selectionBinding="App.selectedPersonController.personId"
optionLabelPath="content.fullName"
optionValuePath="content.id"}}
Run Code Online (Sandbox Code Playgroud)
然而,即使明确地将selectionBinding设置为personId属性,它仍然似乎绑定到person对象.完整的jsfiddle:http://jsfiddle.net/PXVZb/10/
我建议将所选人员绑定到您的App.selectedPersonController并创建一个personId绑定到人员的属性id,请参阅http://jsfiddle.net/PXVZb/11/
JS:
App.selectedPersonController = Ember.Object.create({
personIdBinding: 'person.id'
});
Run Code Online (Sandbox Code Playgroud)
车把:
{{view Ember.Select
contentBinding="App.peopleController.content"
selectionBinding="App.selectedPersonController.person"
optionLabelPath="content.fullName" }}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1370 次 |
| 最近记录: |