启动 DOM 时出现“找不到模板”错误。这是我的代码:
//javascripts/app/app.js
MyApp = Ember.Application.create();
MyApp.store = DS.Store.create({
revision: 4,
adapter: DS.RESTAdapter.create({ bulkCommit: false })
});
//javascripts/app/models/event.js
MyApp.Event = DS.Model.extend({
id: DS.attr('number'),
league_id: DS.attr('number')
});
//javascripts/app/controllers/event.js
MyApp.eventsController = Ember.ArrayController.create({
content: [],
init: function() {
this.content = jQuery.get('events.json');
}
});
//javascripts/app/views/events/list.js
MyApp.EventListView = Ember.View.extend({
templateName: 'app/templates/events/list',
eventsBinding: 'MyApp.eventsController'
});
//javascripts/app/templates/events/list.handlebars
{{#each events}}
{{view MyApp.EventListView eventsBinding='this'}}
{{/each}}
//app/views/events/index.html.erb
<script type='text/x-handlebars'>
{{ view MyApp.EventListView }}
</script>
我尝试了此问答中建议的修复方法之一,但无法让它为我工作。我做错了什么?