title: AngularJS get length of specific item in JSON array
body: <p>Hey I have a JSON array that I'm calling from a service. I have some counters that I'd like to print out the length of the total array and length of some sub items. I'm able to print out the full length of the array but I also would like to print out the total number of items that have a progress "green", "red", and "yellow". Seeing that it's an array of objects, how would I go about to get the length of green, red, yellow? </p>
  
  <p>JSON:</p>
  
  <pre><code>[
     {
       name: User1,
       progress: "green"
     },
     {
       name: User2,
       progress: "yellow"
     },
     {
       name: User3,
       progress: "green"
     },
      {
       name: User4,
       progress: "red"
     },
  ]
  </code></pre>
  
  <p>I'm storing the service called as so:</p>
  
  <pre><code>$scope.requestDetails = [];
  $scope.requestDetails = data;
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div class="total"&gt;{{requestDetails.length}}&lt;/div&gt;
  &lt;div class="red"&gt;&lt;/div&gt;
  &lt;div class="yellow"&gt;&lt;/div&gt;
  &lt;div class="green"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Out of curiosity, I tried to print <code>{{requestDetails.progress.length}}</code> but it comes up empty and printing <code>{{requestDetails[0].progress.length}}</code> prints out the number of letters of the first object's progress value.</p>