{ c" /> { c" /> { c"/>

Angular material snackbar is not working, don't have any error in cli

44 views Asked by At
addtoCart(product: Product): void {
 // console.log("Product Added to cart ", product) 
 this.cartservice.addToCart(product).subscribe({
 next: () =\> {
   console.log("Product Added to cart ", product)
   this.snackbar.open("Product Added to Cart", "", {
     duration: 2000,
     horizontalPosition: 'right',
     verticalPosition: 'top'
   })
  }
})

}

addToCart(product: Product): Observable\<Product\> {
  return this.http.post\<Product\>(this.apiUrl, product)
}

in my cli i don't have any error. it is getting compiled without any errors.

i tried to debug by, console.log getting the product details.

The above function is not working properly it is getting stuck at the this.cartservice.addToCart(product).subscribe snackbar is not popping up.

0

There are 0 answers