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]