Hi all. So I have been following Mosh’s Angular Course on shopping cart and I have been facing an issue in my console that says Cannot read property ‘items’ of null
After following the code I realized that a shopping cart object is not getting created on Firebase itself and the method that throws the error is this method in shopping-cart.service.ts
async getCart(): Promise<Observable<ShoppingCart>> {
let cartId = await this.getOrCreateCartId();
return this.db.object("/shopping-carts/" + cartId)
.valueChanges().pipe(map((x:any) => new ShoppingCart(x.items)));
}
So can anyone please help me in finding out why my shopping cart object is not getting created in firebase? Any help would be highly appreciated.