Angular 10 formatPercent() Method Last Updated : 09 Nov, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 locale format.digitsInfo: Decimal representation options. Return Value: string: the formatted percent string. NgModule: Module used by formatPercent 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 formatPercent.import { LOCALE_ID, NgModule } from '@angular/core';In app.component.ts import formatPercent 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 { formatPercent } from '@angular/common'; import {Component, Inject, LOCALE_ID } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html' }) export class AppComponent { curr = formatPercent(31,this.locale, '3.0-4'); constructor( @Inject(LOCALE_ID) public locale: string,){} } app.component.html <h1> GeeksforGeeks </h1> <p>Locale Percent is : {{curr}}</p> Output: Example 2: app.component.ts import { formatPercent } from '@angular/common'; import {Component, Inject, LOCALE_ID } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html' }) export class AppComponent { curr = formatPercent(31,this.locale, '3.2-4'); constructor( @Inject(LOCALE_ID) public locale: string,){} } app.component.html <h1> GeeksforGeeks </h1> <p>Locale Percent is : {{curr}}</p> Output: Example 3: app.component.ts import { formatPercent } from '@angular/common'; import {Component, Inject, LOCALE_ID } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html' }) export class AppComponent { curr = formatPercent(31.21,this.locale, '3.0-4'); constructor( @Inject(LOCALE_ID) public locale: string,){} } app.component.html <h1> GeeksforGeeks </h1> <p>Locale Percent is : {{curr}}</p> Output: Reference: https://angular.io/api/common/formatPercent Comment More infoAdvertise with us Next Article Angular Primeng MeterGroup Component T taran910 Follow Improve Article Tags : Web Technologies AngularJS AngularJS-Basics AngularJS-Function Angular10 +1 More Similar Reads Angular 10 formatNumber() Method 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 fo 2 min read 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 Angular10 percentPipe In this article, we are going to see what is percentPipe in Angular 10 and how to use it. The percentPipe is used to Transform a number to a percentage string. Syntax: {{ value | percent [ : digitsInfo [ : locale ] ] }} NgModule: Module used by percentPipe is: CommonModule Approach: Create the angul 2 min read Angular Primeng MeterGroup Component Angular PrimeNG is an open-source framework that comes with a large collection of native Angular UI components for amazing style. It makes creating responsive websites a breeze. Multiple metrics or progress indicators are often displayed as a series of progress bars using PrimeNG's MeterGroupModule. 3 min read Angular 10 getLocaleTimeFormat() Function The getLocaleTimeFormat is used to get the localized time-value formatting for the given locale. Syntax: getLocaleTimeFormat(locale: string, width: FormatWidth): string NgModule: Module used by getLocaleTimeFormat is: CommonModule Approach: Create the angular app to be used In app.module.ts import L 2 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 Like