In order to suppress zero in a table you can use ng-if or ng-show. The main difference between these 2 is that ng-if removes rows which do not meet the criteria, on the other hand ng-show only hides the rows. With ng-show, rows which do not meet the criteria will still be in your page but they will be hidden. That is why if you use ng-if, your page will be much faster but be aware that there is a downside with ng-if:
I’ve created the following table:
In this example, I use ng-if, the table creates rows only if the Year value is different to 0 (ng-if="employee.TotalValue!=‘0’).
employee.TotalValue is defined in the first column of the table (ng-model=“employee.TotalValue”):
<tr ng-if="employee.TotalValue!='0'" ng-repeat="employee in page.employees">
The issue now is that if you change the year selection to a year 2011/12 which does not have any data:
and then if you go back to year 2007/08 which should have data, the table will not be displayed:
You will have to refresh the page, in order to see the data.
The workaround for this situation is to use ng-show instead of ng-if:
<tr ng-show="employee.TotalValue!='0'" ng-repeat="employee in page.employees">