Categories
AngularJS Solutions Web

AngularJS – Filter to add Leading 0s to any Number

Lets say you want to display a list of numbers from 1 to n but want them to be displayed as 01 02 03 04 05… and not 1 2 3 4 5… Angular by default doesn’t have a filter for this. Here is how you implement it: Implement the filter in a module. Here […]

Categories
JavaScript Open Source Web

AngularJS – Round off Number to Fixed Length of Fractions

Angular’s built in number filter allows one to specify the number of decimals that should be displayed. The syntax is as follows: {{val | number:<count>}} Where val is the value to be displayed, number is the filtername and count is the number of decimals to be displayed. For eg.: If val is 1234.56789 {{val | […]