Data binding 如何从控制器访问余烬选择视图的值?
我正在构建一个简单的表单,它有几个文本框和一个选择下拉列表,使用其他对象的列表作为数据 到目前为止,我已经连接好了所有内容,所以当用户点击submit时,就会抓取文本表单值并创建一个新对象 我遇到的问题是无法访问select视图的值Data binding 如何从控制器访问余烬选择视图的值?,data-binding,ember.js,Data Binding,Ember.js,我正在构建一个简单的表单,它有几个文本框和一个选择下拉列表,使用其他对象的列表作为数据 到目前为止,我已经连接好了所有内容,所以当用户点击submit时,就会抓取文本表单值并创建一个新对象 我遇到的问题是无法访问select视图的值 {{view Ember.Select contentBinding="courses" optionLabelPath="content.name" optionValuePath="content.id"
{{view Ember.Select
contentBinding="courses"
optionLabelPath="content.name"
optionValuePath="content.id"
selectionBinding="SD.StudentAddController.newCourse"}}
我已经尝试了我能想到的一切,但不知道如何在我的控制器中获取select字段的值
我使用访问所有其他文本字段(因为它们已绑定到控制器的属性):
this.get(“”);
我无法将select视图绑定到控制器的属性“newCourse”。。。有什么想法吗?我错误地引用了要将我的新课程值绑定到的控制器 我把“SD.StudentAddController.newCourse”改成了“controller.newCourse”,它开始工作了 因此,最终选择视图hbs代码为:
{{view Ember.Select
contentBinding="courses"
optionLabelPath="content.name"
optionValuePath="content.id"
selectionBinding="controller.newCourse"}}
Ember Select的selectBinding绑定选定对象
{{view Ember.Select
contentBinding="courses"
optionLabelPath="content.name"
optionValuePath="content.id"
selectionBinding="controller.newCourse"}}