我在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 –