公告
财富商城
积分规则
提问
发文
2020-02-05 06:42发布
啃猪蹄的小仙女
I need to show currency format like these, how can we show.
₹1 ₹10 ₹100 ₹1,000 ₹10,000 ₹1,00,000 ......
You can use this : {{amount:| currency:"₹"}} or you can use hex code for "₹"
{{amount:| currency:"₹"}}
"₹"
Input: {{3*100000000 | currency:"₹"}}
{{3*100000000 | currency:"₹"}}
Output: ₹300,000,000.00
₹300,000,000.00
prefix.replace(/\B(?=(?:\d{2})+(?!\d))/g, ",")
Complete explanation on why this regex places commas at the right place is is mentioned here.
In HTML
{{ currency_expression | currency : symbol : fractionSize}}
for example
{{amount | currency:"₹":0}}
you can also reffer https://docs.angularjs.org/api/ng/filter/currency
Try this one
var x=1000; x=x.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; alert(res);
@Pipe({ name: 'customCurrency' }) export class CustomCurrencyPipe implements PipeTransform { transform(value: number, isSymbol: string, decPointer: string, isPrefix: boolean): string { if (!isNaN(value)) { var formatted_value; var currencyText = isSymbol; if (currencyText == '₹') { // for Indian number system formatted_value = new Intl.NumberFormat('en-IN').format(value) } else { formatted_value = new Intl.NumberFormat().format(value) } return currencyText + ' ' + formatted_value; } } }
HTML
<div>{{ 10000000 | customCurrency:'₹':'1.0':false}}</div>
Just use INR in currency filter
{{product.product_cost | currency:'INR':true}}
最多设置5个标签!
You can use this :
{{amount:| currency:"₹"}}
or you can use hex code for"₹"
Input:
{{3*100000000 | currency:"₹"}}
Output:
₹300,000,000.00
prefix.replace(/\B(?=(?:\d{2})+(?!\d))/g, ",")
Complete explanation on why this regex places commas at the right place is is mentioned here.
In HTML
for example
you can also reffer https://docs.angularjs.org/api/ng/filter/currency
Try this one
HTML
<div>{{ 10000000 | customCurrency:'₹':'1.0':false}}</div>
Just use INR in currency filter