Skip to content

Instantly share code, notes, and snippets.

@acedesigns
Created November 8, 2019 11:59
Show Gist options
  • Save acedesigns/2cd87e14b8e040eb0be71c6c11b1d8fa to your computer and use it in GitHub Desktop.
Save acedesigns/2cd87e14b8e040eb0be71c6c11b1d8fa to your computer and use it in GitHub Desktop.
loadCartItems() {
this.cartService.getCartItems()
.then(val => {
this.cartItems = val;
if (this.cartItems.length > 0) {
this.cartItems.forEach((value, index) => {
console.log(value);
this.totalAmount += parseInt(value.amount);
console.log(this.totalAmount);
});
this.isEmptyCart = false;
}
this.isCartItemLoaded = true;
})
.catch(error => {
console.log(error)
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment