CartComponent#removeetem():
public removeItem(itemId:string) {
this.cartService.removeItem(itemId).subscribe(cart => {
console.log('CartComponent#removeItem', )
this.cartItems = cart.cartItem;
});
}
Typescript为cart.cartItem提供了以下错误:
[ts] Property 'cartItem' does not exist on type 'void'.
any
我已经在另一个应用程序中完成了这项工作,它工作得很好。
CartService移除项()
public removeItem(itemId:string) {
console.log('CartService#removeItem', itemId)
return this.httpClient.delete<Cart>(`${this.cartItemUrl}${itemId}`)
.pipe(
tap(cart => console.log('cart@removeItem', cart)),
// map(cart => this.cart = cart, this.setItemCount()),
map(cart => {
this.cart = cart;
this.setItemCount();
}),
catchError(this.handleError.bind(this))
)
}