I am experiencing an issue with JavaScript calculations. On inspecting the fiddle, I noticed that the answer is displaying as rounded with no decimals, which is confusing to me.
How can I modify my code to display 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>