2
我試圖從api服務器獲取數據,並將ember-data添加到ember-starter-kit中。Ember-data無法讀取未定義的屬性「長度」
與
App = Ember.Application.create();
App.Router.map(function() {
// put your routes here
});
App.ApplicationAdapter = DS.RESTAdapter.extend({
namespace: 'emberjs/ember.js',
host : 'https://api.github.com/repos'
});
App.Store = DS.Store.extend({
adapter: 'App.ApplicationAdapter'
});
App.IndexRoute = Ember.Route.extend({
model: function() {
return this.store.find('pull');
}
});
App.Pull = DS.Model.extend({
url : DS.attr(),
title : DS.attr(),
body : DS.attr()
});
給予同樣的錯誤爲每個請求獲得。然後我嘗試與github,它給出了相同的錯誤。
的API,我連接:當返回多個結果,在這種情況下pulls
,即
{
"pulls": [...]
}
Error while processing route: index Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefined
在哪一行中示出了錯誤? –
處理路由時出錯:index無法讀取未定義的屬性「長度」TypeError:無法讀取未定義的屬性「長度」 –