Angular 10 formatNumber() Method Last Updated : 02 Jun, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we are going to see what is formatNumber in Angular 10 and how to use it. formatNumber is used to format a number based on our requirement in decimal form. Syntax: formatNumber(value, locale, digitsInfo) Parameters: value: The number to format.locale: A locale code for the locale format.digitsInfo: Decimal representation options. Return Value: string: the formatted text string. NgModule: Module used by formatNumber is: CommonModule Approach: Create the Angular app to be used.In app.module.ts import LOCALE_ID because we need locale to be imported for using get formatNumber.import { LOCALE_ID, NgModule } from '@angular/core';In app.component.ts import formatNumber and LOCALE_IDinject LOCALE_ID as a public variable.In app.component.html show the local variable using string interpolationServe the angular app using ng serve to see the output. Example 1: app.component.ts import { formatNumber } from '@angular/common'; import {Component, Inject, LOCALE_ID } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html' }) export class AppComponent { curr = formatNumber(1000,this.locale, '7.1-5'); constructor( @Inject(LOCALE_ID) public locale: string,){} } app.component.html <h1> GeeksforGeeks </h1> <p>Locale Number is : {{curr}}</p> Output: Example 2: app.component.ts import { formatNumber } from '@angular/common'; import {Component, Inject, LOCALE_ID } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html' }) export class AppComponent { curr = formatNumber(100,this.locale, '2.1-5'); constructor( @Inject(LOCALE_ID) public locale: string,){} } app.component.html <h1> GeeksforGeeks </h1> <p>Locale Number is : {{curr}}</p> Output: Example 3: app.component.ts import { formatNumber } from '@angular/common'; import {Component, Inject, LOCALE_ID } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html' }) export class AppComponent { curr = formatNumber(3234,this.locale, '3.1-4'); constructor( @Inject(LOCALE_ID) public locale: string,){} } app.component.html <h1> GeeksforGeeks </h1> <p>Locale Number is : {{curr}}</p> Output: Reference: https://angular.io/api/common/formatNumber Comment More infoAdvertise with us Next Article Angular 10 formatNumber() Method T taran910 Follow Improve Article Tags : Web Technologies AngularJS AngularJS-Directives Angular10 Similar Reads Angular 10 formatDate() Method In this article, we are going to see what is formatDate in Angular 10 and how to use it. formatDate is used to format a date according to locale rules. Syntax: formatDate(value, locale, format, timezone) Parameters: value: The number to format.locale: A locale code for the locale format.format: The 2 min read Angular 10 formatPercent() Method In this article, we are going to see what is formatPercent in Angular 10 and how to use it. formatPercent is used to format a number as a percentage according to locale rules. Syntax: formatPercent(value, locale, digitsInfo) Parameters: value: The number to format.locale: A locale code for the local 2 min read Angular PrimeNG Form InputNumber Component Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will know how to use the InputNumber component in Angular PrimeNG. We will also 7 min read AngularJS number Filter AngularJS number filter is used to convert a number into a string or text. We can also define a limit to display a number of decimal digits. The number filter rounds off the number to specified decimal digits. Syntax: {{ string| number : fractionSize}}Parameter Values: It contains single parameter v 1 min read Angular PrimeNG InputNumber Component Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will know how to use the InputNumber component in Angular PrimeNG. We will also 7 min read Like