angulartypescriptpipes-filters

do not approximate number pipe


I have this code:

"ValorPesos" : 345224.2666860273

<td class="numberAlign-right">{{valorCuota.ValorPesos | currency:code:'CLP':'1.4-4'}}</td>

Current ouput: 34.5224,2667
What i want: 34.5224,2666

Is there any way that the number pipe do not approximate the number?

I didn't saw anything like that in Angular docs.


Solution

  • For a quick work around, you can increase the minFractionDigits and maxFractionDigits by 1 and slice the resultant string to exclude the last character by

    unRoundedCurrency = roundedCurrency.slice(0, -1);
    

    To accomplish this, you can create a function in component and return the resultant currency string from there, after applying angular's currency pipe using the method described below.

    How to use angular pipe from component