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

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Ole Ersoy
Ole Ersoy

Written by Ole Ersoy

Founder of Firefly Semantics Corporation

No responses yet

Write a response