所以,对于 ember,它使用 id 来识别模型,它在 http 请求中也使用它
http://localhost/api/users/12
有没有办法使用不同的值作为它的 id?例如用户名?
结果是这样的......
http://localhost/api/users/john99
最佳答案
原来我不得不这样做
App.ApplicationSerializer = DS.RESTSerializer.extend({
primaryKey: "username"
});
在尝试了很多不同的方法之后,这是唯一有效的方法。
关于javascript - 使用 id 以外的其他值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19792221/