PercentPipe

Stable Pipe

What it does

Formats a number as a percentage according to locale rules.

How to use

number_expression | percent[:digitInfo]

NgModule

CommonModule

Description

Formats a number as percentage.

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.

Example

@Component({
  selector: 'percent-pipe',
  template: `<div>
    <p>A: {{a | percent}}</p>
    <p>B: {{b | percent:'4.3-5'}}</p>
  </div>`
})
export class PercentPipeComponent {
  a: number = 0.259;
  b: number = 1.3495;
}

exported from @angular/common/index defined in @angular/common/src/pipes/number_pipe.ts

doc_Angular
2016-10-06 09:46:49
Comments
Leave a Comment

Please login to continue.