What it does
Formats a number according to locale rules.
How to use
number_expression | number[:digitInfo]
Formats a number as text. Group sizing and separator and other locale-specific configurations are based on the active locale.
where expression
is a number:
digitInfo
is astring
which has a following format:
{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}
minIntegerDigits
is the minimum number of integer digits to use. Defaults to1
.minFractionDigits
is the minimum number of digits after fraction. Defaults to0
.maxFractionDigits
is the maximum number of digits after fraction. Defaults to3
.
For more information on the acceptable range for each of these numbers and other details see your native internationalization library.
WARNING: this pipe uses the Internationalization API which is not yet available in all browsers and may require a polyfill. See 浏览器支持 for details.
Example
NgModule
CommonModule
Description
exported from common/index defined in common/src/pipes/number_pipe.ts