From CartComponent I am calling the removeItem() function in CartService.
CartComponent#removeItem():
public removeItem(itemId:string) {
this.cartService.removeItem(itemId).subscribe(cart => {
console.log('CartComponent#removeItem', )
this.cartItems = cart.cartItem;
});
}
Typescript is giving the following error for cart.cartItem:
[ts] Property 'cartItem' does not exist on type 'void'.
any
I have done precisely this in another application and it works just fine.
CartService#removeItem()
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))
)
}