ngx-numeral
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

ngx-numeral

npm version npm Build Status Coverage Status

An Angular pipe module for interfacing the Awesome Numeraljs library.

Installation

npm i -S ngx-numeral

Usage

Add NumeralModule to your application module.

@NgModule({
 declarations: [
   AppComponent
 ],
 imports: [
   NumeralModule.forRoot()
   // ...
 ],
 bootstrap: [AppComponent]
})

export class AppModule { }

Use Pipe within your template file

<h1>{{ '12345.123' | numeral:'$0,0.00' }}</h1>

Or instatiate NumeralPipe in your components with the desired value.

import { NumeralPipe } from 'ngx-numeral';

class ExampleComponent implements OnInit {
  formatted_string: string;

  ngOnInit() {
    const numeral = new NumeralPipe('7784.374');
    this.formatted_string = numeral.format('$0,0.00');
  }
}

A demo application is also included.

Package Sidebar

Install

npm i ngx-numeral

Weekly Downloads

95

Version

1.0.0

License

MIT

Unpacked Size

13.3 kB

Total Files

9

Last publish

Collaborators

  • jogboms