处理路由时出错,适配器操作失败

时间:2015-12-16 04:48:07

标签: ember.js

运行以下代码时,我收到一个错误,即适配器操作失败。

(aap.js)

App = Ember.Application.create();

App.Store=DS.Store.extend({

adapter:'DS.FixtureAdapter' 
});
 //App.ApplicationAdapter = DS.FixtureAdapter.extend();



App.Router.map(function(){
    this.route('posts');
    this.route('about');
});

App.PostsRoute=Ember.Route.extend({
    model:function(){
        return this.store.find('post');
    }
})

1 个答案:

答案 0 :(得分:0)

存储期望的扩展/创建的适配器名称中的

adapter:参数或适配器对象,例如你创建了像App.ApplicationAdapter = DS.FixtureAdapter.extend();这样的应用程序适配器,所以你的适配器参数应该是'application',但如果没有在商店中指定适配器,它将默认为应用程序适配器,因此需要指定它