-1
export class AppComponent  {
  value1 = 0;
  value2 = 0.00;
  value3 = 0.01;
}
<p>
  {{value1}} - shows 0
</p>
<p>
  {{value2}}  shows 0
</p>
<p>
  {{value3}}  shows 0.01
</p>

Hello, I need to show values in html with 2 places after decimal. For example I need to show 0.00 when it's 0. Is it possible? Stackblitz link - https://stackblitz.com/edit/angular-4cm9yr

Edric
  • 24,639
  • 13
  • 81
  • 91
Paweł Meller
  • 321
  • 1
  • 2
  • 12

1 Answers1

2

Use .toFixed(decimals)

(0).toFixed(2); -> 0.00

Constantin Chirila
  • 1,979
  • 2
  • 19
  • 33
konenas
  • 80
  • 1
  • 12