我将我的应用程序代码从多个 js 文件合并到一个 js 文件中。因此我无法控制顺序,老实说也不想。要使用 ember-model 指定自定义适配器,您需要像这样创建它的实例:
App.User.adapter = Ember.CustomAdapter.create();
因此,如果 CustomAdapter 的代码出现在上述语句之后,我会收到[Uncaught TypeError: Cannot call method 'create' of undefined]错误。
App.User.adapter = App.CustomAdapter.create();
App.CustomAdapter = Ember.Adapter.extend({
// custom
});
有没有解决的办法?