Ember.js textField更改事件 [英] Ember.js textField change event
问题描述
我刚刚开始学习ember.js
为什么使用此代码 http://jsfiddle.net/ alexchetv / RVNzP / 无法正常工作-仅在MyTextField失去焦点之后才触发App.MyTextField.change()执行吗?
具有相同功能的替代代码可以按预期工作。
I just start to learn ember.js Why this code http://jsfiddle.net/alexchetv/RVNzP/ don't work properly -- App.MyTextField.change() execution is triggered only after MyTextField loses focus? Alternative code with the same functionality works as expected.
推荐答案
请记住,Ember.Views上的处理程序(更改,选择,单击等)绑定到常规HTML DOM事件。仅当输入字段失去焦点并已更改时,才在输入字段上调用 onchange,而不是在任何时候修改该值。如果您希望收到有关显示值更改的通知,则应注意值。
Keep in mind that handlers on your Ember.Views (change, select, click, etc) are bound to normal HTML DOM events. "onchange" only gets called on an input field when the field loses focus and has changed, not any time the value is modified. You should observe 'value' if you want to be notified of changes to the displayed value.
这篇关于Ember.js textField更改事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!