I want to add items to cart and display total sum. Here I created a function addTo() with a purpose to add each item and then I created function getCost() to multiple price and num of the item. Then I want to display total sum automatically every time when I click 'add to cart'. Please, help me to build this function. I have no idea.
angular.module('TransactionApp', [])
.controller('TransactionsCtrl', function($scope) {
   $scope.title = 'Online-store';
   $scope.itemsArray = [
    {  price: 50, name: "Whey protein", img: 'img/item-1.png', quantity: 0},
    {  price: 60, name: "Protein bar", img: 'img/item-1.png', quantity: 0  },
    {  price: 35, name: "BCAA", img: 'img/item-1.png', quantity: 0  },
    {  price: 50, name: "Whey protein", img: 'img/item-1.png', quantity: 0  },
    {  price: 60, name: "Protein bar", img: 'img/item-1.png', quantity: 0  },
    {  price: 80, name: "BCAA", img: 'img/item-1.png', quantity: 0  }
   ];
   $scope.addTo = function(item) {
       item.quantity += 1;
     }
     $scope.getCost = function(item) {
      return item.quantity * item.price;
     }
   $scope.cart = [];
   $scope.getTotal = function() {
   }
});
