如果小数点后末尾为零,则包括角货币管道

问题描述 投票:0回答:1

我正在使用Angular。严格要求我显示从后端获得的完整数字我在最后一个示例中知道零“ 123.450123.45相同,但根据客户端,我们需要显示完整数字。

 <td>{{ material.customerPrice | currency:'EUR':true}}</td>

Component: 
this.material.customerPrice = "234.54530" // Output should be : 234.54530 not 234.5453
or
this.material.customerPrice = "12.5456540" // Output should be : 12.5456540 not 12.545654

小数点后没有固定数字。

我需要在可显示全位数的有角货币管道中添加任何其他参数。

html angular angular-pipe
1个回答
0
投票
the angular currency pipe的前三个参数是这样的:

currency:<Country Code>:<Symbol>:<min digits before the decimal>.<min digits after decimal>-<max digits after decimal>

因此,根据您的情况,您希望小数点后至少1位,小数点后至少3位,以及小数点后最多20位(用最大为20代替)

currency:'EUR':'symbol':'1.3-20'

© www.soinside.com 2019 - 2024. All rights reserved.