title: Calculating sum of repeated elements in AngularJS ng-repeat
body: <p>The script below displays a shop cart using <code>ng-repeat</code>. For each element in the array, it shows the item name, its amount and the subtotal (<code>product.price * product.quantity</code>).</p>
  
  <p>What is the simplest way for calculating the total price of repeated elements?</p>
  
  <pre><code>&lt;table&gt;
  
      &lt;tr&gt;
          &lt;th&gt;Product&lt;/th&gt;
          &lt;th&gt;Quantity&lt;/th&gt;
          &lt;th&gt;Price&lt;/th&gt;
      &lt;/tr&gt;
  
      &lt;tr ng-repeat="product in cart.products"&gt;
          &lt;td&gt;{{product.name}}&lt;/td&gt;
          &lt;td&gt;{{product.quantity}}&lt;/td&gt;
          &lt;td&gt;{{product.price * product.quantity}} €&lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;tr&gt;
          &lt;td&gt;&lt;/td&gt;
          &lt;td&gt;Total :&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt; &lt;!-- Here is the total value of my cart --&gt;
      &lt;/tr&gt;
  
  &lt;/table&gt;
  </code></pre>