这是带有灯具的模型文件:
App.Game = DS.Model.extend({
name: DS.attr('string'),
isCompleted: DS.attr('boolean')
});
App.Game.FIXTURES = [
{
id: 1,
name: '-TEMPIN-',
description: 'Test',
websiteUrl: 'http://www.kefsensei.com'
},
{
id: 2,
name: '¡Oh My GlobZ Mucho Party!',
description: 'Test',
websiteUrl: 'http://www.youtube.com/watch?v=hCBc2mWXeu4&'
},
{
id: 3,
name: '90s Arcade Racer',
description: 'Test',
websiteUrl: 'http://www.kefsensei.com'
}
];
这是我的index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link href='http://fonts.googleapis.com/css?family=Lato:400,700' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=PT+Sans:400,700' rel='stylesheet' type='text/css'>
<link href="/sass/main.css" media="screen" rel="stylesheet" type="text/css" />
</head>
<body>
<script type="text/x-handlebars" data-template-name="games">
<div class="container_12">
<ul class="games">
{{#each}}
<li>
<div class="description grid_8">
<h1>{{name}}</h1>
<p>Description:{{description}}</p>
</div>
<div class="categorization grid_4">
</div>
</li>
{{/each}}
</ul>
</div>
</script>
<script src="/javascripts/vendor.js" type="text/javascript"></script>
<script src="/javascripts/application.js" type="text/javascript"></script>
</body>
</html>
这是我的路由器: App.Router.map(function(){ this.resource('games',{path:'/'}); });
App.GamesRoute = Ember.Route.extend({
model: function() {
return this.store.find('game');
}
});
无论我做什么,当我导航到我的应用程序的根目录时绑定和显示的模型的唯一属性是'name'属性。
如果我更改了'name'属性的名称,它就不再绑定了。 description属性不绑定。
我做错了什么?
答案 0 :(得分:0)
您需要在模型上定义属性
App.Game = DS.Model.extend({
name: DS.attr('string'),
description: DS.attr('string'),
websiteUrl: DS.attr('string'),
isCompleted: DS.attr('boolean')
});