title: How to create sum of numbers from ng-repeat directive
body: <p>I'm trying to sum a column of numbers but when I use code below, the "total" field is empty. Any thoughts on what I might be doing wrong? </p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;tr ng-repeat="project in projectList.projects&gt;   
      &lt;td&gt;{{project.description}}&lt;/td&gt;
      &lt;td&gt;{{project.type.cost | currency}}&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;h2&gt;Total: {{ total() | currency }}&lt;/h2&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>myApp.controller('ProjectListCtrl', function ProjectListCtrl(Projects) {
  var projectList = this;
  projectList.total = function(){
      var total = 0;
      angular.forEach(projectList.projects, function(project) {
          total += project.type.cost;
      });
      return total;
  };
  })
  </code></pre>