Angular Pipe Number 2 Decimal Places Example
Today our leading topic is angular pipe number 2 decimal places. Here you will learn angular pipe decimal 2 digits. you'll learn angular decimal pipe 2 digits. if you want to see example of angular 2 digit after decimal point pipe then you are a right place.
you can easily use pipe for 2 digits after decimal point in angular 7, angular 8, angular 9, angular 10, angular 11, angular 12, angular 13, angular 14, angular 15, angular 16 and angular 17 version.
here, you have to follow few step to create simple example of pipe 2 digits after decimal point.
In this simple example, you can see i take two variable and it's has 3 or 4 digits after decimal point. so let's see how to display with 2 digits after decimal point.
app/app.component.ts
import { Component, VERSION } from "@angular/core";
@Component({
selector: "my-app",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.css"]
})
export class AppComponent {
name = "Angular " + VERSION.major;
myNumber = 34.5673;
myNumber2 = 104.566445;
}
Ok, now we can use custom pipe in html file, so let's write it.
app/app.component.html
<h1>angular pipe number 2 decimal places Example - ItSolutionStuff.com</h1>
<p>{{ myNumber | number : '1.2-2' }}</p>
<p>{{ myNumber2 | number : '1.2-2' }}</p>
Output:
I hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- Angular Pipe for Boolean Value with Yes No Text
- Angular Pipe for Alphabetical Order Example
- Angular Pipe for Phone Number Example
- Angular Create Custom Pipe for Replace Null Values Example
- Angular 11/10 Create Custom Pipe Example
- Angular Pipes Example | Angular Pipes List Tutorial
- Angular Uppercase Pipe Example | Uppercase Pipe in Angular
- Angular Decimal Pipe Example | Number Pipe in Angular
- Angular Nl2br Pipe Example