Ember计算的属性未更新

时间:2014-06-19 01:07:26

标签: javascript ember.js

如果您查看下面的代码(JSBin created here),您会看到当我在搜索框中输入时,computedValuealiasedValue属性应该更新,但不要#&# 39;吨

组件JS App.SearchComponent = Ember.Component.extend({ search: 'initial', aliasedValue: Ember.computed.alias('search'), computedValue: function(){ return 'computedValue'; }.property('search') });

组件模板 {input value=search}}<br> search: {{search}}<br> computedValue: {{computedValue}}<br> aliasedValue: {{aliasedValue}}<br>

我使用Ember App Kit以模块格式完成了同样的事情,它运行正常。正是在这种情况下,使用App全局我无法使其发挥作用。

我在这里错过了一些非常简单的东西,但是无法解决这个问题吗?

谢谢, 专利

1 个答案:

答案 0 :(得分:2)

组件应该是dasherized,因此{{do-it}}将匹配

App.DoItComponent

在您的情况下{{search-component}}将映射到

App.SearchComponentComponent

所以它将它映射到一个Empty组件,这就是为什么没有工作的原因

http://emberjs.jsbin.com/vuzozobu/1/edit