我有一个自定义的ember.select,我要覆盖"更改"事件以自己处理事件(例如,启动XHR)
在我的车把文件中,我在每一行中添加了一个选择(arraycontroller backed)
{{#each thing in controller}}
{{view App.CustomSelect value=thing.category content=configuration optionValuePath="content.id" optionLabelPath="content.name"}}
{{/each}}
在我的javascript中,我像
一样处理该事件App.CustomSelect = Ember.Select.extend({
change: function(x) {
//in here I can only get the selected option / value
//what I really need is both that value (above)
//and the model for this given row
}
});
如何将模型绑定到更改事件中的特定选择?
查看我自己的代码,要获取模型,您需要执行以下操作:
App.CustomSelect = Ember.Select.extend({
change: function(x) {
var selectedModel = this.get('selection');
}
});