gpt4 book ai didi

angular - Ionic 3 货币格式

转载 作者:搜寻专家 更新时间:2023-10-30 22:04:42 24 4
gpt4 key购买 nike

我正在尝试使用以下命令格式化货币

<h1>R$ {{item.valor | currency:"BRL":true:1.2 }}</h1> 

但是显示了这个错误

digitsinfo.match is not a function

如何在 Ionic 3 中以正确的格式获取钱?

最佳答案

看看 CurrencyPipe docs .管道需要以下格式:

{{ value_expression | currency [ : currencyCode [ : display [ : digitsInfo [ : locale ] ] ] ] }}

digitsInfo 应该是

a string which has a following format: {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}.

( Source ,重点是我的)

因此将您的 digitsInfo 格式化为字符串应该可以修复您的错误:

<h1>R$ {{item.valor | currency:"BRL":true:"1.2" }}</h1> 

关于angular - Ionic 3 货币格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50435756/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com