angularjs fractionsize with dot

Solutions on MaxInterview for angularjs fractionsize with dot by the best coders in the world

showing results for - "angularjs fractionsize with dot"
Janna
18 Jan 2017
1app.filter('comma2decimal', [
2function() { // should be altered to suit your needs
3    return function(input) {
4    var ret=(input)?input.toString().trim().replace(",","."):null;
5        return parseFloat(ret);
6    };
7}]);
8
Ronan
19 Feb 2019
1app.filter('decimal2comma', [
2function() {// should be altered to suit your needs
3    return function(input) {
4        var ret=(input)?input.toString().replace(".",","):null;
5        if(ret){
6            var decArr=ret.split(",");
7            if(decArr.length>1){
8                var dec=decArr[1].length;
9                if(dec===1){ret+="0";}
10            }//this is to show prices like 12,20 and not 12,2
11        }
12        return ret;
13    };
14}]);
15