totals = [];
get grandTotal() {
let i;
let sub_total = 0;
let grand_total = 0;
if (this.isSubmitted == true) {
if (typeof this.product_price !== "undefined" && typeof this.quantity !== "undefined") {
sub_total = this.product_price * this.quantity;
this.totals.push(sub_total);
}
}
for (i = 0; i < this.totals.length; i++) {
grand_total += this.totals[i];
}
return grand_total;
}
<td>{{grandTotal | currency:'USD':true }}</td>