ikismail/Angular-ShoppingCart

Pushing Favourite Product to firebase

AKhileshPothuri opened this issue · 1 comments

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.

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