[Fixed] why is angular number pipe not displaying if number has a leading zero?

Issue

Why does number pipe not display when the value has a leading zero when I use it like below?

0.35 won’t display in UI.
3.5 will display.

<!-- numbVal = 0.35 -->

<!-- output '' -->
<div>
 {{numbVal | number }}
</div>

<!-- output '' -->
<div>
 {{numbVal | number:'3.1-5' }}
</div>



<!-- numbVal = 3.5 -->

<!-- output '3.5' -->
<div>
 {{numbVal | number }}
</div>

<!-- output '003.5' -->
<div>
 {{numbVal | number:'3.1-5' }}
</div>

Solution

Try this:

{{numbVal | number:'1.1-5' }}

It will get it to display 0.35.

Leave a Reply

(*) Required, Your email will not be published