我准备了一个小提琴来更好地暴露问题。
代码:
App = Ember.Application.create();
App.MyView = Ember.View.extend({ templateName: "MyView" });
App.myCollectionView = Ember.CollectionView.create({
itemViewClass: App.MyView,
content: [
Ember.Object.create({ name: "World" }),
Ember.Object.create({ name: "Foo" }),
Ember.Object.create({ name: "Bar" })
]
});
$(function() { App.initialize(); });
看法 :
<script type="text/x-handlebars">
{{collection App.myCollectionView}}
</script>
<script type="text/x-handlebars" data-template-name="MyView">
<h1>Hello, {{name}}!</h1>
</script>
我在这里做错了什么?