Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 18 days ago
JSON representation

An Angular pipe module for interfacing the Awesome Numeraljs library.

Awesome Lists containing this project

README

        

# ngx-numeral
[![npm version](https://badge.fury.io/js/ngx-numeral.svg)](https://badge.fury.io/js/ngx-numeral)
[![npm](https://img.shields.io/npm/dt/ngx-numeral.svg?label=npm%20downloads)](https://www.npmjs.com/package/ngx-numeral)
[![Build Status](https://travis-ci.org/jogboms/ngx-numeral.svg?branch=master)](https://travis-ci.org/jogboms/ngx-numeral)
[![Coverage Status](https://coveralls.io/repos/github/jogboms/ngx-numeral/badge.svg?branch=master&cacheBuster=1)](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.