Registry / productivity / ng-number-formatter

ng-number-formatter

JSON →
library3.2.1jsnpmunverified

Angular Number Formatter for Angular 2+ (including Angular 6, 8, 11). Formats numbers into human-readable strings with options: default (metric symbol like 37.5K), metrics-symbol, metrics-name (e.g., 37.5 thousands), comma-separated, and emoji representation. Works with integers, floats, negative numbers, and numeric strings. Stable version 3.2.1; last tested with Angular 11 but compatible with later versions. Differentiator: includes emoji formatting not found in similar libraries.

npm install ng-number-formatter
INSTALL
IMPORT
SIG · NG-NUMBER-FORMATTE
N
ng-number-formatter
productivityjavascriptv3.2.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

NgNumberFormatterModule
import { NgNumberFormatterModule } from 'ng-number-formatter';
import NgNumberFormatterModule from 'ng-number-formatter';
Named import, not default.
NgNumberFormatterComponent
import { NgNumberFormatterComponent } from 'ng-number-formatter';
import { NgNumberFormatter } from 'ng-number-formatter';
The component class is named NgNumberFormatterComponent.
NgNumberFormatterConfig
import { NgNumberFormatterConfig } from 'ng-number-formatter';
TypeScript interface for configuration options (if used).

Import the module and use the component with ngNumber and optional ngFormat inputs.

import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; import { NgNumberFormatterModule } from 'ng-number-formatter'; @NgModule({ declarations: [AppComponent], imports: [BrowserModule, NgNumberFormatterModule], bootstrap: [AppComponent] }) export class AppModule {} // In template: // <ng-number-formatter [ngNumber]="1222130" [ngFormat]="'metrics-symbol'"></ng-number-formatter> // <ng-number-formatter [ngNumber]="1222130" [ngFormat]="'comma'"></ng-number-formatter>
Debug
Known issues
deprecatedUse of 'ngNumber' input with hyphenated syntax: [ngNumber] is correct, but older docs may show [ng-number] incorrectly.
fix
Always use [ngNumber] (camelCase) as input binding.
affects: >=3.0.0
gotchaThe library must be imported in an Angular module (not standalone component by default); NgNumberFormatterModule is required.
fix
Add NgNumberFormatterModule to the imports array of the NgModule where the component is used.
affects: >=3.0.0
gotchaEmoji format outputs spaces between digits; unexpected if you need compact emoji string.
fix
For compact emoji, manually remove spaces via string replacement.
affects: >=3.0.0
gotchaThe ngFormat input accepts strings: 'default', 'metrics-symbol', 'metrics-name', 'comma', 'emoji'. Mistyping causes fallback to default formatting.
fix
Use exact string values listed above; consider defining a type or constant.
affects: >=3.0.0
Errors
Common errors & fixes
ERROR in Can't bind to 'ngNumber' since it isn't a known property of 'ng-number-formatter'.
NgNumberFormatterModule not imported in the module.
fix
Import NgNumberFormatterModule in your NgModule imports array.
ERROR Error: Uncaught (in promise): Type NgNumberFormatterComponent is part of the declarations of 2 modules
NgNumberFormatterModule imported in multiple modules that both declare the component.
fix
Import NgNumberFormatterModule only in the root module (e.g., AppModule) and use it in child modules via forChild or simply re-export.
Template parse errors: 'ng-number-formatter' is not a known element
Missing NgNumberFormatterModule import in the current module.
fix
Add NgNumberFormatterModule to your module imports.
Upgrade
Version history
3.2.1latest on npm
Audit
Dependencies
@angular/corerequiredRequires Angular framework core
@angular/commonrequiredRequired for Angular module imports
Agent activity
12 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
ng-number-formatter — npm install ng-number-formatter · libregistry