Help Angular by taking a 1 minute survey!Go to surveyHome

DeprecatedPercentPipe

Formats a number as percentage according to locale rules.

See more...

{{ value_expression | percent [ : digits ] }}
      
      {{ value_expression | percent [ : digits ] }}
    

NgModule

Input value

value any

Parameters

digits string

Optional. Default is undefined.

Description

WARNING: this pipe uses the Internationalization API which is not yet available in all browsers and may require a polyfill. See Browser Support for details.

Usage notes

Example

@Component({ selector: 'deprecated-percent-pipe', template: `<div> <!--output '25.9%'--> <p>A: {{a | percent}}</p> <!--output '0,134.95%'--> <p>B: {{b | percent:'4.3-5'}}</p> </div>` }) export class DeprecatedPercentPipeComponent { a: number = 0.259; b: number = 1.3495; }
      
      
  1. @Component({
  2. selector: 'deprecated-percent-pipe',
  3. template: `<div>
  4. <!--output '25.9%'-->
  5. <p>A: {{a | percent}}</p>
  6.  
  7. <!--output '0,134.95%'-->
  8. <p>B: {{b | percent:'4.3-5'}}</p>
  9. </div>`
  10. })
  11. export class DeprecatedPercentPipeComponent {
  12. a: number = 0.259;
  13. b: number = 1.3495;
  14. }