I have a simple ng-repeat that loops through a JSON file with a list of countries and details about that country e.g. currency, population for a particular set of months (24 in this case)
My ng-repeat loops through the first 12 months successfully, and displaying the corresponding text when the ng-switch criteria is met.
The issue i am facing, is that for some countries, we there is less than 12months worth of data, in some cases, only 3 months.
What i am struggling to do, is that if there is not sufficient data available, to display an empty cell.
Here's my ng-repeat:
<tr ng-repeat="country in Countries[key]">
<th>{{country.countryName}}</th>
<td ng-repeat="countryDetails in country.Details.slice(0, 12)" ng-switch="countryDetails.Population">
<span ng-switch-when="10000">Medium</span>
<span ng-switch-when="20000">Large</span>
<span ng-switch-when="30000">Larger</span>
<span ng-switch-when="40000">Very Large</span>
<span ng-switch-default>Error</span>
</td>
</tr>
Thanks