Javascript Ember.js如何使用Em.按钮
我一直尝试(未成功)使用Em.按钮触发控制器上的操作,但它似乎没有触发目标函数。我这样做有什么不对吗?按钮呈现得非常好,控制台中不会抛出任何错误。我使用的是github的0.9.3标记版本Javascript Ember.js如何使用Em.按钮,javascript,ember.js,Javascript,Ember.js,我一直尝试(未成功)使用Em.按钮触发控制器上的操作,但它似乎没有触发目标函数。我这样做有什么不对吗?按钮呈现得非常好,控制台中不会抛出任何错误。我使用的是github的0.9.3标记版本 <script type='text/x-handlebars'> {{#view Em.Button target="App.Controllers.Cards" action="reveal"}} Reveal {{/view}} App.Controll
<script type='text/x-handlebars'>
{{#view Em.Button target="App.Controllers.Cards" action="reveal"}}
Reveal
{{/view}}
App.Controllers.Cards = Em.ArrayProxy.create({
content: [],
reveal: function() {
console.log('blah');
}
});
{{{#查看Em.Button target=“App.Controllers.Cards”action=“discover”}
显露
{{/view}
App.Controllers.Cards=Em.ArrayProxy.create({
内容:[],
显示:函数(){
console.log('blah');
}
});
嗯,您的代码似乎工作正常
车把:
<script type="text/x-handlebars">
{{#view Em.Button target="App.Controllers.Card" action="reveal"}}
Reveal
{{/view}}
</script>
结果证明这是一个愚蠢的错误。我将应用程序的根元素设置为“review”,而不是正确的“review”。
App = Ember.Application.create({});
App.Controllers = Em.Object.create();
App.Controllers.Card = Em.ArrayProxy.create({
content: [],
reveal: function() {
console.log('blah');
}
});