DS.RESTAdapter.map is undefined
DS.RESTAdapter.map is undefined
所以,我一直在试图找出如何在 ember 中的不同模型上设置不同的主键,我看到人们使用 App.Adapter.map
来实现这一点。
但是,无论我尝试什么,似乎余烬中都没有地图功能,这就是我尝试过的。
App.Adapter = DS.Adapter.extend(); // .map === undefined
App.Adapter = DS.RESTAdapter.extend(); // .map === undefined
我尝试了更多,但一切似乎都undefined
.
我也做过这样的事情
App.Store = DS.Store.extend({
adapter: App.Adapter.create()
});
不会改变任何东西。
有谁知道为什么会这样,我一直在对primaryKey
进行硬编码,现在我需要将其更改为单个模型。
当前硬编码
App.ApplicationSerializer = DS.RESTSerializer.extend({
primaryKey: 'username'
});
目标:
App.Adapter.map('App.Person', {
primaryKey: 'username'
});
这是看到地图的地方http://ember-website.thomasboyt.com/api/data/modules/data-serializer.html -- 第 4 个代码块关闭https://stackoverflow.com/a/15480105/1907358
有没有人知道为什么会发生这种情况?
您可以为每个模型指定自定义序列化程序,如下所示:
App.PersonSerializer = DS.RESTSerializer.extend({ primaryKey: 'username' });
App.PostSerializer = DS.RESTSerializer.extend({ primaryKey: 'foo' });
相关文章:
- Jquery - table.row(tr) is undefined
- noty.js is returning undefined
- $routeParams is undefined
- Angular js $scope is Undefined
- $scope is coming as undefined
- Angular - $cookies is undefined
- TypeError: e is undefined - javascript
- “google.maps.MapTypeId is undefined”在FF 14中使用GMAP3时
- chrome.storage.local["mykey"] is undefined
- 回调在 Angular2/Firebase 中生成“TypeError: this is undefined”
- KendoWindow .visible(); is undefined?
- jQuery .forEach() 导致错误,“undefined is not a function”
- 使用“flickrnode”API时出现“TypeError: undefined is not a function”
- "undefined is not a function" onSuccessHandler
- 莫名其妙的“Undefined is not a function”错误 — 由“getElementsById”引起
- Angular js 在传递 promise 时$asyncValidator“Undefined is not a f
- undefined is not a function when evaluating 'this.batman
- “uncatch TypeError: undefined is not a function” 在使用 str.ind
- 谷歌地图API(使用gmapsjs), setCenter抛出“undefined is not a function”
- 在骨干应用视图中出现" Uncaught TypeError: undefined is not a function