1.1.1 • Published 5 years ago

fl-number-formatter v1.1.1

Weekly downloads
12
License
-
Repository
-
Last release
5 years ago

Angular Number Formatter

Number Formatter for Angular; Transforms the number into human readable format when in Thousands, Millions and Billions.

  • 37474 -> 37.5K
  • 1222130 -> 1.2M
  • 12414770 -> 12.4M
  • 19121364128 -> 19.1B

Installation

npm install fl-number-formatter --save

Usage

Import FlNumberFormatterModule

You need to import the FlNumberFormatterModule in the module of your app where you want to use it.

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { FlNumberFormatterModule } from 'fl-number-formatter';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    FlNumberFormatterModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Use the fl-number-formatter selector

Place the fl-number-formatter and pass the un-formatted number as an input to ngNumber

<fl-number-formatter [ngNumber]="1222130"></fl-number-formatter>

FlNumberFormatter

This project was generated with Angular CLI version 7.3.6.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.