Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我将模型分配给商店然后调用
var model = Store.create({id:0,firstName:"john",lastName:"smith",department:"sales"}); model.save();
这会发送一个 PUT 请求。它不应该发送一个POST吗?我尝试不包括 id 字段,但随后会引发验证错误。任何想法我做错了什么?
看起来您无法发送任何 id 并将其 POST。那么最好的方法是
var model = Store.create({firstName: "john", lastName: "smith", department: "sales"}); Store.add(model);
或者
var model = new MyModel({firstName: "john", lastName: "smith", department: "sales"}); Store.add(model);