angular 印度格式的货币过滤器
angular currency filters in indian format
我正在开发基于 angular 的应用程序,它是一个财务应用程序。其中,我需要在动态 html 中以货币格式显示数字。以下是我用于此要求的方式:
$filter('currency')(amount)
它工作正常,但它以美国格式显示数字,但我需要以印度格式显示数字。
Example : var amount = 100000
如果我采用上述方式,则数字显示为 100,000.
期望输出:1,00,000
任何帮助将不胜感激。
你可以使用 Number.Prototype.toLocaleString() 作为你的印度人你可以直接使用它,但是如果你必须指定格式,请将其指定为 Number("100000").toLocaleString('en-IN' )
检查以下代码段
console.log(Number("100000").toLocaleString('en-IN'));
希望对您有所帮助
试试这个
Html
{{amount | currency:"₹":0}}
在html中添加此格式{{amount | currency:"₹":0}} 您也可以在下面的 url 上看到它。
https://docs.angularjs.org/api/ng/filter/currency
我正在开发基于 angular 的应用程序,它是一个财务应用程序。其中,我需要在动态 html 中以货币格式显示数字。以下是我用于此要求的方式:
$filter('currency')(amount)
它工作正常,但它以美国格式显示数字,但我需要以印度格式显示数字。
Example : var amount = 100000
如果我采用上述方式,则数字显示为 100,000.
期望输出:1,00,000
任何帮助将不胜感激。
你可以使用 Number.Prototype.toLocaleString() 作为你的印度人你可以直接使用它,但是如果你必须指定格式,请将其指定为 Number("100000").toLocaleString('en-IN' )
检查以下代码段
console.log(Number("100000").toLocaleString('en-IN'));
希望对您有所帮助
试试这个
Html
{{amount | currency:"₹":0}}
在html中添加此格式{{amount | currency:"₹":0}} 您也可以在下面的 url 上看到它。 https://docs.angularjs.org/api/ng/filter/currency