App.AccountsRoute = Ember.Route.extend({
model: function() {
return this.store.find('Account', {company: 'Blah'});
}
});
但總是得到一個錯誤信息:
Error while processing route: accounts Cannot read property 'map' of undefined TypeError: Cannot read property 'map' of undefined
at s.map (http://localhost/public/bower_components/ember/ember.min.js:10:14956)
at Ember.Object.extend.pushMany (http://localhost/public/bower_components/ember-data/ember-data.min.js:10:6083)
at c.extend.load (http://localhost/public/bower_components/ember-data/ember-data.min.js:9:19306)
at http://localhost/public/bower_components/ember-data/ember-data.min.js:9:31635
at a (http://localhost/public/bower_components/ember/ember.min.js:12:1824)
at i (http://localhost/public/bower_components/ember/ember.min.js:12:1743)
at c (http://localhost/public/bower_components/ember/ember.min.js:12:2476)
at http://localhost/public/bower_components/ember/ember.min.js:13:11367
at e.invoke (http://localhost/public/bower_components/ember/ember.min.js:11:24893)
at Object.e.flush (http://localhost/public/bower_components/ember/ember.min.js:11:25401) ember.min.js:10
n.function.n.apply.r ember.min.js:10
A.error ember.min.js:18
i ember.min.js:18
s ember.min.js:19
e.trigger ember.min.js:19
(anonymous function) ember.min.js:19
a ember.min.js:12
i ember.min.js:12
h ember.min.js:12
(anonymous function) ember.min.js:13
e.invoke ember.min.js:11
e.flush ember.min.js:11
t.end ember.min.js:11
(anonymous function)
如果我擺脫了查詢參數的,即:
App.AccountsRoute = Ember.Route.extend({
model: function() {
return this.store.find('Account');
}
});
然後一切正常。我使用的是ember 1.6.0和ember-data 1.0.0-beta8。我已經嘗試了幾個不同的版本,以防發生錯誤,但無法解決問題。
任何想法有什麼不對?
糟糕的JSON響應,你會介意添加JSON,當你用查詢做它返回? – Kingpin2k