Agon Fejza
Agon Fejza

Reputation: 63

Angular 2 Rounding numbers - percentage

How can i generate this percentage: number * 100 ( ex. 0.050 * 100 = 5.5 ) i get the number from db like 0.050 but need to be showed as 5.5

actual code

  <strong>{{d.AllowancePercentage}} %</strong>

Upvotes: 1

Views: 944

Answers (1)

The simplest way I found is this:

{{ (d.AllowancePercentage * 100) | number:'1.1-2' }}

Here's the official documentation: https://angular.io/api/common/PercentPipe

Upvotes: 1

Related Questions