0

我完成了 ember 入门 todo 指南。

然后我使用正确的命名约定构建了一个 JSON Webapi。

ember 成功调用 api 并检索信息然后我收到以下错误消息,我不确定我将如何调试它

Assertion failed: No model was found for '0' ember.js:394
(anonymous function) ember.js:394
Ember.assert ember.js:53
DS.Store.Ember.Object.extend.modelFor ember-data-latest.js:2177
DS.RESTSerializer.DS.JSONSerializer.extend.extractArray ember-data-latest.js:6403
superWrapper ember.js:1218
(anonymous function) ember-data-latest.js:89
DS.JSONSerializer.Ember.Object.extend.extract ember-data-latest.js:196
(anonymous function) ember-data-latest.js:2649
invokeCallback ember.js:8055
(anonymous function) ember.js:8105
EventTarget.trigger ember.js:7878
(anonymous function) ember.js:8172
DeferredActionQueues.flush ember.js:5459
Backburner.end ember.js:5545
Backburner.run ember.js:5584
Ember.run ember.js:5915
hash.success ember-data-latest.js:7115
l jquery.js:9597
c.fireWith jquery.js:9597
k jquery.js:9597
(anonymous function) jquery.js:9597




Error while loading route: TypeError {} ember.js:394
(anonymous function) ember.js:394
Ember.Router.reopenClass._defaultErrorHandler ember.js:30563
triggerEvent ember.js:30520
trigger ember.js:29641
handleError ember.js:29903
invokeCallback ember.js:8055
(anonymous function) ember.js:8109
EventTarget.trigger ember.js:7878
(anonymous function) ember.js:8180
DeferredActionQueues.flush ember.js:5459
Backburner.end ember.js:5545
Backburner.run ember.js:5584
Ember.run ember.js:5915
hash.success ember-data-latest.js:7115
l jquery.js:9597
c.fireWith jquery.js:9597
k jquery.js:9597
(anonymous function) jquery.js:9597


Uncaught TypeError: Cannot set property 'store' of undefined ember-data-latest.js:2179
DS.Store.Ember.Object.extend.modelFor ember-data-latest.js:2179
DS.RESTSerializer.DS.JSONSerializer.extend.extractArray ember-data-latest.js:6403
superWrapper ember.js:1218
(anonymous function) ember-data-latest.js:89
DS.JSONSerializer.Ember.Object.extend.extract ember-data-latest.js:196
(anonymous function) ember-data-latest.js:2649
invokeCallback ember.js:8055
(anonymous function) ember.js:8105
EventTarget.trigger ember.js:7878
(anonymous function) ember.js:8172
DeferredActionQueues.flush ember.js:5459
Backburner.end ember.js:5545
Backburner.run ember.js:5584
Ember.run ember.js:5915
hash.success ember-data-latest.js:7115
l jquery.js:9597
c.fireWith jquery.js:9597
k jquery.js:9597
(anonymous function)
4

1 回答 1

1

我认为从服务器返回的有效负载缺少 json 数组的根键,例如:

this.store.find('user')

服务器的预期响应是:

{
  users: [ ... ]
}

可能您正在使用:

[...]

如果你看到这个小提琴同样的错误被抛出,因为缺少people http://jsfiddle.net/marciojunior/8GfG4/

于 2013-09-19T13:06:22.500 回答