Implementing Angularjs version 1.xx
var processedInput = text.replace(/[^0-9.]/g, '')
.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
if(processedInput!="")
processedInput="$"+processedInput;
Input = 123456789, Desired Output = $123,456,789
However, I am looking for the following desired output:
Input = 20.56, Desired Output = $20.5600
Input = 20, Desired Output = $20.0000
Input = 20.567, Desired Output = $20.5670