0
我有多个购物车。 每个购物车都有多个产品。Ember数据删除嵌套记录
当我从购物车中删除产品时,生成的网址尝试全局删除产品,而不仅仅是从特定的购物车中删除。产生
App.IndexRoute = Ember.Route.extend({
model: function() {
return this.store.find("cart", 2);
},
actions: {
remove: function(product){
product.deleteRecord();
product.save();
}
}
});
{{#each product in model.products}}
<div>{{product.title}} <button {{action "remove" product}}>x</button></div>
{{/each}}
HTTP请求DELETE产品/ {ID}
我希望它以某种方式包括在URL车ID。如何处理这种情况?
演示:http://jsbin.com/lecejejara/1/edit?html,js
这样,当我想删除一条记录时,我必须将整个购物车发送到服务器。如何发送只有一个项目的想法被删除,以提高性能? – Tomas 2015-02-13 09:12:00