如何正确设置控制器的型号?
这是我的代码(出现错误):
<script>
window.App = Ember.Application.create();
App.Store = DS.Store.extend({
revision: 11,
adapter: 'DS.FixtureAdapter'
});
App.ApplicationRoute = Ember.Route.extend({
setupController: function() {
this.controllerFor('topic').set('model', App.Topic.find());
}
});
App.Topic = DS.Model.extend({
label: DS.attr('string'),
selected: DS.attr('boolean')
});
App.Topic.FIXTURES = [
{ id: 1, label: '1. First topic', selected: true },
{ id: 2, label: '2. Second topic' },
{ id: 3, label: '3. Third topic' },
];
App.TopicController = Ember.ArrayController.extend();
App.IndexController = Ember.ObjectController.extend({
content: [],
test: 'INDEX TEST',
currentTopics: null
});
</script>
模板(试图将 TopicController 绑定到 Ember.Select 视图)
<script type="text/x-handlebars" data-template-name="index">
{{view Ember.Select
contentBinding="App.TopicController"
selectionBinding="currentTopics"
optionLabelPath="content.label"
optionValuePath="content.id"}}
</script>
版本: ember 1.0.0-pre4 ember-data 修订版 11