I have some 10 textboxes and if user enters 10.3691 then it should be changed to 10.37
<input ng-model='data.value1' ng-blur="formatDecimals1()">
<input ng-model='data.value2' ng-blur="formatDecimals2()">
......
In controller,
$scope.formatDecimals1 = function() {
$scope.data.value1= Number($scope.data.value1).toFixed($scope.data.value1Points);
}
$scope.formatDecimals2 = function() {
$scope.data.value2= Number($scope.data.value2).toFixed($scope.data.value2Points);
}
I feel this is not a right way... any other solution to achieve this. Or, how we can have single common function to format all textbox inputs.