https://github.com/jogboms/ngx-numeral
An Angular pipe module for interfacing the Awesome Numeraljs library.
https://github.com/jogboms/ngx-numeral
angular ngx-numeral numbers numeraljs pipe
Last synced: 6 months ago
JSON representation
An Angular pipe module for interfacing the Awesome Numeraljs library.
- Host: GitHub
- URL: https://github.com/jogboms/ngx-numeral
- Owner: jogboms
- License: mit
- Created: 2017-12-10T07:11:03.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-01-22T11:43:08.000Z (over 3 years ago)
- Last Synced: 2025-04-12T23:33:09.189Z (6 months ago)
- Topics: angular, ngx-numeral, numbers, numeraljs, pipe
- Language: TypeScript
- Homepage:
- Size: 33.2 KB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ngx-numeral
[](https://badge.fury.io/js/ngx-numeral)
[](https://www.npmjs.com/package/ngx-numeral)
[](https://travis-ci.org/jogboms/ngx-numeral)
[](https://coveralls.io/github/jogboms/ngx-numeral?branch=master)An Angular pipe module for interfacing the Awesome [Numeraljs](http://numeraljs.com/) library.
## Installation
```bash
npm i -S ngx-numeral
```## Usage
Add `NumeralModule` to your application module.
```ts
@NgModule({
declarations: [
AppComponent
],
imports: [
NumeralModule.forRoot()
// ...
],
bootstrap: [AppComponent]
})export class AppModule { }
```Use Pipe within your template file
``` html
{{ '12345.123' | numeral:'$0,0.00' }}
```Or instatiate `NumeralPipe` in your components with the desired value.
```ts
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.