Ember JS 的 DS FixtureAdapter 错误未定义

DS FixtureAdapter error Undefined for Ember JS

我不断收到 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 对于 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>

DS.FixtureAdapter 不是 ember.js 的一部分您需要包含 ember-data.js,它仍处于测试阶段,需要从 here.

下载

工作示例here