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