Embers js中的更改侦听器上的组合框

拉吉

使用下面的代码,我在ember中显示组合框。

{{view  "select"  content=model    prompt="Please select a name"  selectionBinding="App.selectedComboBoxController.model"  optionValuePath="content.fullName" optionLabelPath="content.title"   }}

输出http://emberjs.jsbin.com/jodaqumoba/1/edit?html,css,js,输出

我的要求是组合框更改时间如何在提交功能下方调用

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);
    }
  }
});

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章