我只是想使用 Handlebars 助手来渲染视图。应用程序运行时我不断收到错误消息:
Uncaught TypeError: Cannot call method 'apply' of undefined
车把:
<script type='text/x-handlebars'>
{{outlet}}
</script>
<script type='text/x-handlebars' id="index">
INDEX
{{my-component-helper}}
</script>
<script type='text/x-handlebars' id="myComponentHelper">
I'm here
</script>
JS:
App = Ember.Application.create();
Ember.Handlebars.helper('my-component-helper', App.MyComponentHelperView);
App.MyComponentHelperView = Ember.View.extend({
templateName:'myComponentHelper'
});
这是一个说明问题的 JSbin:http: //jsbin.com/edUm/1/edit