我无法访问我的数组控制器变量。例如,我有这个简单的应用程序:
应用程序.js
App = Ember.Application.create();
App.ApplicationAdapter = DS.FixtureAdapter.extend();
App.Router.map(function() {
this.route('hello');
});
App.IndexRoute = Ember.Route.extend({
redirect: function() {
this.transitionTo('hello');
}
});
App.HelloController = Ember.ArrayController.extend({
name: 'tom'
});
App.HelloRoute = Ember.Route.extend({
model: function() {
return this.store.find('hello');
}
});
App.Hello = DS.Model.extend({
title: DS.attr('string')
});
App.Hello.FIXTURES = [{
id: 1,
title: 'hello'
},{
id: 2,
title: 'hello'
}];
我的观点是:
<script type="text/x-handlebars" data-template-name="application">
<h2>Welcome to Ember.js</h2>
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="hello">
{{#each}}
{{title}} {{name}}
{{/each}}
</script>
当我保存这段代码时,页面只呈现“hello”“hello”,我期待“hello tom”“hello tom”。我做错了什么?
帮助表示赞赏!