Transforms a number to have a certain amount of digits in its integer part and also in its decimal part.
Name | Type | Default value | Description |
---|---|---|---|
digitsInfo | DecimalNumberModel | A format to apply to the date value. Date Pipe Formats. | |
locale | string | 'en-US' | A locale id for the locale format rules to use. |
This pipe transforms a given number so it follows the set configuration for the pipe. You can change this configuration by changing the parameters in your app.config.json
.
"decimalValues": {
"minIntegerDigits": 1,
"minFractionDigits": 0,
"maxFractionDigits": 2
}
You can also overwrite this config by passing a DecimalNumberModel
as an argument for this pipe.
The number can be also localized so it applies commas and dots in the right place depending on the locale id in use.
decimalNumberPipe.transform(1234.567); //Returns '1,234.57' decimalNumberPipe.transform(1234.567, digitsConfig, "it"); //Returns '1.234,57'
And now with a different config:
digitsConfig = { minIntegerDigits: 6, minFractionDigits: 4, maxFractionDigits: 4 }; decimalNumberPipe.transform(1234.567, digitsConfig); //Returns '001,234.5670'
More info: Angular DecimalPipe
© 2023 Alfresco Software, Inc. All Rights Reserved.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.