升級到最新版本的ember-data(1.0 beta 5 ...我之前爲v 14)後遇到一些麻煩。我得到的錯誤是「加載路徑時出錯:TypeError:無法設置未定義的屬性」商店「。在這一點上我沒有設置商店。在路由中調用「模型」函數後,錯誤就會發生。任何指針讚賞。Ember-Data中的模型/商店問題
CallMonitor.ContactPoint = DS.Model.extend({
"status": DS.attr('string'),
"contact": DS.belongsTo('contact')
});
CallMonitor.Contact = DS.Model.extend({
"type": DS.attr('string'),
"status": DS.attr('string'),
"message": DS.attr('string'),
"creator": DS.attr('string'),
"spid": DS.attr('string'),
"added": DS.attr('date'),
"contactPoints": DS.hasMany('contactPoint')
});
CallMonitor.ApplicationAdapter = DS.RESTAdapter.extend({namespace: 'api'});
CallMonitor.ContactsRoute = Ember.Route.extend({
model: function(){
return this.store.find('contact');
},
setupController: function(controller, contacts)
controller.set('contact', contacts);
}
});