Formatting Your Angular Number to 2 Decimal Places

Ole Ersoy
Sep 2, 2019

--

Photo by 35mm on Unsplash

Updated Version

There’s an updated version of this article here:

Scenario

We have a number 12.45343532. We want it to look like this:

12.45 .

Approach

Within the component template pipe the value through the number pipe like this:

<div>{{ value | number:'1.2-2' }}</div>

Brought To You By

--

--

Ole Ersoy
Ole Ersoy

Written by Ole Ersoy

Founder of Firefly Semantics Corporation

No responses yet