I have created a custom pipe to get only 2 values after decimal point for amount.
let beforedecimal = value.split('.')[0];
let afterdecimal = value.split('.')[1];
if (afterdecimal.length < 2)
{
while (afterdecimal.length < 2) {
afterdecimal = afterdecimal+'0'
}
}
else if (afterdecimal.length > 2)
{
afterdecimal= afterdecimal.substring(0,1);
}
result = (beforedecimal+'.'+afterdecimal).trim();
return result;
This is working fine for amount having values after decimal point but getting undefined if there is nothing after the decimal point i.e., 56000.00 for this amount getting blank in UI screen.
Also, I want commas at appropriate places as this is amount i.e., 56,000.00
Thanks