The addCommas helper formats a numeric value by adding commas to separate thousands. Use it for improving the readability of large numbers, such as counts, totals, or financial values.
Format large numbers
{{addCommas record.stats.views}} {{addCommas record.stats.downloads}}
Input:
{
"record": {
"stats": {
"views": 1234567,
"downloads": 987654321
}
}
}
Output:
1,234,567 987,654,321
Display formatted totals
{{addCommas record.totalSales}}
Input:
{ "record": { "totalSales": 45200000 } }
Output:
45,200,000
Combine with text
Total views: {{addCommas record.views}}
Input:
{ "record": { "views": 1543220 } }
Output:
Total views: 1,543,220
Tip
-
Works with both integer and floating-point numbers.
-
If the value is
null,undefined, or not numeric, the helper returns an empty string. -
Ideal for displaying user metrics, prices, or quantities in readable format.