Hi,
Here is a way in angularjs by which you can change a floating point number to integer -
In your index.html
<script>angular.module('Example', []).controller('ExampleController',[$scope',function($scope){
$scope.val = 123.455;
}])
</script>
<div ng-controller="ExampleController"><label>Enter number:<input ng-model='val'></label>
<br>
<br>
number in floating point format:<span id='number-default'>
{{val | number}}
</span>
<br>
number in integer format:<span>
{{val | number:0}}
</span>
<br>
Negative number:<span>
{{-val | number:4}}
</span>
<br>
</div>
Thanks
No comments:
Post a Comment