percent pipe

Transforms a number to a percentage string, formatted according to locale rules that determine group sizing and separator, decimal-point character, and other locale-specific configurations.

Source
<p>A: {{a | percent}}</p>
<p>B: {{b | percent:'4.3-5'}}</p>
export class AppComponent {
  a = 0.259;
  b = 1.3495;
}
Result

A: 26%

B: 0,134.950%

Parameters

{{ value_expression | percent [ : digitsInfo [ : locale ] ] }}

digitsInfo#

Decimal representation options.

digitsInfo?: string

Specified by a string in the following format:

{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}
  • minIntegerDigits: The minimum number of integer digits before the decimal point. Default is 1.
  • minFractionDigits: The minimum number of digits after the decimal point. Default is 0.
  • maxFractionDigits: The maximum number of digits after the decimal point. Default is 3.

locale#

A locale code for the locale format rules to use.

locale?: string

When not supplied, uses the value of LOCALE_ID, which is en-US by default. See Setting your app locale.