我can.Model
用来通过以下方式检索数据id
:
Invoice = can.Model({
findAll: 'GET /invoices',
create : "POST /invoices",
update : "PUT /invoices/{id}",
destroy : "DELETE /invoices/{id}"
},{});
导航到/invoices
时,结果与预期一致,例如:
[
0: {
"ID": "1",
"Client": "Client1",
},
1: {
"ID": "2",
"Client": "Client2"
}
]
但是,使用控制台检索Invoice.findAll
并记录到控制台的数据看起来像这样,列表中的每个元素都重复了相同的数据项:
[
0: {
"ID": "1",
"Client": "Client1"
},
1: {
"ID": "1",
"Client": "Client1"
}
]
服务器的响应是正确的,那么为什么它被解释为相同项目的列表呢?