Javascript 余烬js中更改侦听器的组合框
我使用下面的代码在余烬中显示组合框Javascript 余烬js中更改侦听器的组合框,javascript,asp.net-mvc,ember.js,handlebars.js,Javascript,Asp.net Mvc,Ember.js,Handlebars.js,我使用下面的代码在余烬中显示组合框 {{view "select" content=model prompt="Please select a name" selectionBinding="App.selectedComboBoxController.model" optionValuePath="content.fullName" optionLabelPath="content.title" }} 输出 我的要求是组合框更改时间如何调用下面的提交功能 App.Comb
{{view "select" content=model prompt="Please select a name" selectionBinding="App.selectedComboBoxController.model" optionValuePath="content.fullName" optionLabelPath="content.title" }}
输出
我的要求是组合框更改时间如何调用下面的提交功能
App.ComboBoxRoute = Ember.Route.extend({
model: function () {
return posts;
},
actions: {
submit: function () {
textId = document.getElementById("emnn");
textId = textId.value;
alert(textId);
}
}
});
您可以向组合框值添加观察者。在“观察者”中,发送一个动作,该动作将使路线冒泡
App.SelectedComboBoxController = Em.ObjectController.extend({
model:null,
selectionChanged: function() {
this.send('submit', this.get('model'));
}.observes('model')
});
App.IndexRoute = Ember.Route.extend({
model: function() {
return [
{fullName:"the full name1", title:"the title1"},
{fullName:"the full name2", title:"the title2"},
{fullName:"the full name3", title:"the title3"}
];
},
actions: {
submit: function (item) {
alert(item.fullName);
}
}
});