如何创建一个表单来保存ember.js中的1:n关系

时间:2013-05-31 23:20:12

标签: forms ember.js relation

我有一个1:n的关系。例如,一个有n 个人。如何使用选择框为实体人员创建表单以将其添加到组?我试过类似下面的观点:

{{! Create Person}}
{{view Ember.TextField valueBinding='model.text'}}
{{view Ember.Select 
  valueBinding='model.group'
  optionValuePath='content.id'
  optionLabelPath='content.name'
  contentBinding='App.Group.FIXTURES'
  prompt='Please Select'}}

如何修改 contentBinding 才有意义?我正在使用ember.js 1.0.0-RC4。

1 个答案:

答案 0 :(得分:1)

您想使用selectionBinding代替valueBinding

假设当前模板中有person

{{view Ember.Select
       contentBinding='App.Group.FIXTURES'
       optionValuePath="content"
       optionLabelPath="content.name"
       selectionBinding="person.group"}}
相关问题