我正在尝试让我的余烬.js应用程序工作。
我在应用程序/路由/索引.js中有以下代码:
import Ember from 'ember';
export default Ember.Route.extend({
model() {
// works - it calls the server
Ember.$.getJSON('http://localhost:20000/Wallet');
// does not work - server not hit
this.get('store').findAll('Wallet');
// this does not work either - server not hit
this.store.queryRecord('/Wallet', {}).then(function(wallet) {
//
});
// return some dummy data for now
return 7111;
}
});
在我的应用程序/适配器/应用程序中.js:
import DS from 'ember-data';
export default DS.JSONAPIAdapter.extend({
host: 'http://localhost:20000',
});
"this.get('store').findAll('Wallet');"方法不起作用。(服务器未被击中。
我的代码有什么问题?
您需要添加一个选项来根据文档调用:
model(){
return this.get('store').findAll('wallet', { reload: true });
}