ikismail / Angular-ShoppingCart

ShoppingCart (Ecommerce) 🛒 Application using Angular10, Firebase, PWA, Drag&Drop, Materialized Bootstrap and i18n 🚀🔥👨‍💻
https://angular-shoppingcart.firebaseapp.com/
MIT License
621 stars 387 forks source link

Pushing Favourite Product to firebase #51

Closed AKhileshPothuri closed 4 years ago

AKhileshPothuri commented 5 years ago

addFavouriteProduct(data: Product): void {

    let a: Product[];

-->>> this.favouriteProducts.push(data);

    a = JSON.parse(localStorage.getItem('avf_item')) || [];
    a.push(data);
    this.toastrService.wait('Adding Product', 'Adding Product as Favourite');
    setTimeout(() => {
        localStorage.setItem('avf_item', JSON.stringify(a));
        this.calculateLocalFavProdCounts();
    }, 1500);
}

I was trying to push the favourite items of the users to the database. But I'm getting an error at the line I represented with an '-->'.. Could you please help me with that.

ikismail commented 5 years ago

@AKhileshPothuri Can you post the exact error screenshot that showed in console.