title: AngularJS: Change cell class in a dynamically generated table based on cell value
body: <p>I have a dynamically generated table by the following code:</p>
  
  <pre><code>&lt;tbody&gt;
      &lt;tr ng-repeat="row in tableType.data.rows track by $index"&gt;
          &lt;td ng-repeat="col in row track by $index" class={{getUnitCountCellColor(col)}}&gt;{{col}}&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p>The data over which the table is iterated looks like:</p>
  
  <pre><code>[["69123", 20, 20, 40, 0, 0, 0, 0, 20, 20, 20, 0, 20, 20, 0, 20],
   ["69121", 20, 20, 40, 0, 0, 0, 20, 20, 40, 20, 0, 20, 20, 0, 20],
   ["69124", 20, 20, 40, 0, 0, 0, 0, 0, 0, 20, 0, 20, 0, 0, 0],
   ["69221", 20, 20, 40, 20, 0, 20, 0, 0, 0, 20, 0, 20, 20, 20, 40]
  ]
  </code></pre>
  
  <p>As you can see the data is a nested array. Now I am trying to set the colour of each cell based on its value, by called the method <strong>getUnitCountCellColor()</strong> which is defined in the parent controller scope.</p>
  
  <p>The method simply gets the value and returns the colour class based on the value as a string. (eg: danger, success) </p>
  
  <p>Currently it is being called only 4 times with value <strong>'undefined'</strong>.   </p>
  
  <p>I tried to implement this with <strong>ng-class</strong> as:</p>
  
  <pre><code>&lt;td ng-repeat="col in row track by $index" ng-class="getUnitCountCellColor(col)"&gt;{{col}}&lt;/td&gt;
  </code></pre>
  
  <p>But then the method is not called at all.</p>
  
  <p>Please help me implement this functionality, either by pointing out the error in my current code or by a different better approach.</p>
  
  <p>Thanking You,</p>