1cartTotal(): void {
2
3 const {total, quantity} = this.carrello.plu.reduce((acc, item) => {
4 acc.quantity += item.qta;
5 acc.total = acc.total + (item.prezzo * item.qta);
6 return acc;
7 }, {total:0, quantity:0});
8
9 this.cartCount.next(acc.quantity); // emit whatever you want to emit.
10}
11
12console.log('Total Price', total, 'Total Quantity', quantity);