0
我创建了我的第一个组件,但大多数教程都假设我没有使用ember-rails。在ember-rails中创建组件时的命名约定
据我所知,一个组件需要扩展Ember.Components,也有它自己的模板,都需要正确命名,然后它可以在把手内部使用并放置在任何模板中。
我哪里错了?
# app/assets/javascripts/components/table-of-contents.js.coffee
App.TableOfContentsComponent = Ember.Component.extend
# app/assets/javascripts/templates/components/table-of-contents.js.hbs
<h2>Look Ma! My component works!
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
# app/assets/javascripts/templates/somepage.js.hbs
<h1>Here be Some Page with it's own Table of Contents</h2>
{{table-of-contents}}
该控制台给我这个荒谬的错误后,我包括{表的,内容{}}在SomePage的模板,我尝试打开SomePage的
Uncaught Error: Assertion Failed: You must pass a view to the #view helper, not function() {
[编辑1:找到更多info内的信息。 Daah。其实没有预料到它会有更多的信息。现在通过:https://github.com/emberjs/ember-rails]