我一直收到DS.FixtureAdapter未定义错误。我不知道如何解决这个错误。我在使用App.PersonAdapter = DS.FixtureAdapter.extend({})获取错误;
这是app.js代码。
App = Ember.Application.create();
App.Router.map(function() {
// put your routes here
});
App.PersonAdapter = DS.FixtureAdapter.extend({});
App.Person = DS.Model.extend({
firstName: DS.attr(),
lastName: DS.attr(),
age: DS.attr()
});
App.IndexRoute = Ember.Route.extend({
model: function() {
return this.store.find('person');
}
});
App.Person.FIXTURES = [
{
id: 1,
firstName: 'John',
lastName: 'Doe',
age: 39
},
{
id: 2,
firstName: 'Jane',
lastName: 'Doe',
age: 29
}
]
index.html for ember js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ember Starter Kit</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<script type="text/x-handlebars">
<h2>Welcome to Ember.js</h2>
{{outlet}}
</script>
<script type="text/x-handlebars" id="index">
<ul>
{{#each item in model}}
<li>{{item.firstName}} - {{item.lastName}} is of age {{item.age}}</li>
{{/each}}
</ul>
</script>
<script src="js/libs/jquery-1.10.2.js"></script>
<script src="js/libs/ember-template-compiler-1.10.0.js"></script>
<script src="js/libs/ember-1.10.0.debug.js"></script>
<script src="js/libs/ember-data.js"></script>
<script src="js/app.js"></script>
<!-- to activate the test runner, add the "?test" query string parameter -->
<script src="tests/runner.js"></script>
</body>
</html>