Hi,
In invoice i have 2 fields named as qty and price
i have stored these variables in one array
total number should not 2 decimals
Ex:123.12(I need like this)
123.123(I don't need)
Could kindly any one help me
Here my sample code
Sum of ng repeat elements
..........................
$scope.total = function(){
var total = 0;
angular.forEach($scope.invoice.items, function(item){
total += item.qty * item.price;
})
return total;
}
});

Piyush PansuriyaRank #454 · 5.5K reputationPosted Jan 1, 2019, 7:22 PM EST
Sreekanth ReddyRank #726 · 3.2K reputationPosted Jan 1, 2019, 7:26 PM EST
Mahesh ReddyRank #4,018 · 371 reputationPosted Jan 1, 2019, 8:46 PM EST
Muthu KumarRank #935 · 2.2K reputationPosted Jan 1, 2019, 10:09 PM EST
For more reference.
https://stackoverflow.com/questions/2221167/javascript-formatting-a-rounded-number-to-n-decimals
Mahesh ReddyRank #4,018 · 371 reputationPosted Jan 1, 2019, 10:14 PM EST