CollectionView
アイテムのリストを作成し、CollectionView
のtemplateName
プロパティで指定されたテンプレートにレンダリングしようとしています。しかし、私はそれを働かせることはできません。Ember.CollectionViewでテンプレートを使用する方法
が、それは次のようになります。このようなテンプレートと
App = Ember.Application.create({});
App.ItemView = Ember.View.extend({
templateName: 'item_template',
tagName: 'li'
});
App.CollectionViewTest = Ember.CollectionView.extend({
templateName: 'collection_template',
itemViewClass: App.ItemView,
content: [
{ title: 'Item 1' },
{ title: 'Item 2' }
]
});
:
<script type="text/x-handlebars" data-template-name="application">
<h1>Testing CollectionView TemplateName</h1>
{{collection App.CollectionViewTest}}
</script>
<script type="text/x-handlebars" data-template-name="collection_template">
<h2>The CollectionView Template</h2>
<ul>
{{outlet}}
</ul>
</script>
<script type="text/x-handlebars" data-template-name="item_template">
{{title}}
</script>
ことがあるので、私はEmber.View
にApp.CollectionViewTest
を変更しない限り、<h2>
は、レンダリングされることは決してありませんが、その後、明らかにリスト項目はありません。
これはバグですか?または私は何かを逃している? Ember.CollectionViewがEmber.ContainerViewのサブクラスであるので、それはそれ自身のテンプレートを持っていませんhttp://jsfiddle.net/S46vH/
と置き換えてください。http://jsfiddle.net/S46vH/は基本的に空白ですが、ここにリンクを投稿する前に最新バージョンを保存しましたか? – intuitivepixel
oops、no。すべきだった:http://jsfiddle.net/S46vH/1/しかし問題は今解決した。どうもありがとう。 – rainbowFish