title: Angular Typescript looping through array of objects to find the count
body: <p>I need help not sure what I'm missing. I am trying to loop through an array of objects in Angular to find count of a specific field in objects. For instance I want to find out how many ID's came in with the risk of 'Moderate', 'High','Low'?</p>
  
  <p>I can count the total amount of objects for having trouble counting the number of risks associated with a type of risk like 'Moderate'</p>
  
  <p><strong>json:</strong></p>
  
  <pre><code>[ 
  {"id": 1, 
   "risk": "Moderate"
  },
  {"id": 2, 
   "risk": "Low"
  },
  
  {"id": 3, 
   "risk": "Moderate"
  },
  {"id": 4, 
   "risk": "High"
  }]
  </code></pre>
  
  <p><strong>component.ts</strong></p>
  
  <pre><code>countTotalChanges() {
      let count = 0; 
  
          for (var i = 0; i &lt; this.changeService.length; i++) {
              count++; 
      }
      return count;
    }
  
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>{{countTotalChanges()}}
  </code></pre>