I want to display digit always with two decimal values. I can display values with two decimal values.
$scope.value1 = 10000;
$scope.value2 = 12444.44443;
In controller I used
$scope.value1 = $scope.value1.toFixed(2);
$scope.value2 = $scope.value2.toFixed(2);
Then in HTML, I can display as "10000.00" "12444.44". But its changing my model value also. I don't want to change the value. I want to display value only as "1000.00" "12444.44".
Even I tried as
{{value1 | setDecimal : 2 }}
{{value2 | setDecimal : 2 }}
It displays as
10000
12444.44
This setDecimal changes only my decimal value.
I want to display like setDecimal but need to display 10000 also as 10000.00.
{{value1 | number: 2}}docs.angularjs.org/api/ng/filter/number . not sure where you saw the "setDecimal" pipe, but the "number" pipe should be enough here.toFixedor whatever unless it's strictly needed: angularjs is heavy already, so avoid adding stuff that exists already. Thenumberpipe was invented for such a scope, so just use it.