大家好,我目前在Angular2中遇到http.delete
有困难。我试图删除我的JSON API中的记录,但没有任何东西被删除。这是我的代码:
let headers= new Headers();
headers.append('Content-Type', 'application/json');
let options= new RequestOptions({headers:headers});
this.http.delete('http://sample.xyz/xxx/api.php/cart?filter=cart.customer_id,eq,21&transform=1',options)
.subscribe((ok)=>{
console.log("Successfully Deleted." +ok)
}, (err) => {
this.showPopup("Oops!", "Something went wrong on deletion." +err);
});
以下是我要删除的记录(' http://sample.xyz/xxx/api.php/cart?filter=cart.customer_id,eq,21&transform=1
'):
cart: [
{
cart_id: 25,
customer_id: 21,
prod_id: 27,
cart_quantity: 2,
cart_subtotal: "2710",
cart_datetime_added: "0000-00-00 00:00:00",
cart_type: "Mobile"
},
{
cart_id: 26,
customer_id: 21,
prod_id: 27,
cart_quantity: 10,
cart_subtotal: "2710",
cart_datetime_added: "0000-00-00 00:00:00",
cart_type: "Mobile"
},
{
cart_id: 27,
customer_id: 21,
prod_id: 128,
cart_quantity: 2,
cart_subtotal: "800",
cart_datetime_added: "0000-00-00 00:00:00",
cart_type: "Mobile"
},
{
cart_id: 36,
customer_id: 21,
prod_id: 10,
cart_quantity: 5,
cart_subtotal: "895",
cart_datetime_added: "0000-00-00 00:00:00",
cart_type: "Mobile"
},
{
cart_id: 42,
customer_id: 21,
prod_id: 104,
cart_quantity: 2,
cart_subtotal: "4500",
cart_datetime_added: "0000-00-00 00:00:00",
cart_type: "Mobile"
}
]
有关如何删除此记录的任何建议?希望你们能帮助我。提前谢谢你:)