我在Ember Cli版本:0.2.3Ember控制器奇怪的错误
我目前正在探索与Ember,并尝试一个非常简单的应用程序。
我在模板中有这样的/ about.hbs
<h1>About</h1>
<p>I'll write something interesting here</p>
<button type="btn btn=primary"{{action 'clickMe'}}>Click me!</button>
,并在我的控制器/ about_controller.js
Blogger.AboutController = Ember.Controller.extend({
actions: {
clickMe: function() {
alert('Something something');
}
}
});
当我按一下按钮我得到这个错误,我查了语法,似乎无法捕捉到错误。我需要一些新鲜的眼睛。
Uncaught Error: Nothing handled the action 'clickMe'. If you did handle the action, this error can be caused by returning true from an action handler in a controller, causing the action to bubble.
现在,我明白了信息的意思,但我不知道如何解决它。
[命名约定](http://www.ember-cli.com/#naming-conventions)很重要,文件名应该是'about.js',你应该使用es6模块。 –
@Kitler当我第一次创建about控制器我有它命名about.js,虽然我得到了这个错误 '未捕获的错误:预计发现:'控制器:关于'博客/控制器/约'内''但'未定义' 。你忘了在'博主/控制器/'关于'吗?'出口默认'?' – Diego
你忘了导出吗? :P –