I'm having an issue when doing calculation with javascript. As you can see in the fiddle, the answer show up rounded with no decimals and I dont understand why.
What do I need to do to show the decimals of $scope.total?
var moment = angular.module('moment',[]);
moment.controller('momentCtrl', ['$scope', function($scope) {
$scope.val1 = 96;
$scope.val2 = 18;
$scope.val3 = Math.PI;
$scope.val4 = 13.5;
$scope.total = parseInt( $scope.val1 ) + parseInt( $scope.val2 ) - parseInt( $scope.val3 ) - parseInt( $scope.val4 );
}]);
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="moment" ng-controller="momentCtrl">
Value = {{total}} <br>
Should be something like 97.3584
</div>
parseInt...parseIntanyway?parseIntin your calculations. Those are all numbers.