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

6.0.5 • Public • Published

NgxUnitsConverter

Angular module wrapper inspired by convert-units

Pls try - Demo

Installing

npm install --save ngx-units-converter

Usage

import {UnitsConvererModule} from 'ngx-units-converter'

(...)

@NgModule({
  (...)
  imports: [
    UnitsConvererModule
  ]
  (...)
})

Pipe

 Params
  - from: string, 
  - to: string, 
  Optionals
  - round: number
  
  <p> {{ 20 | unitsConverter: { from: 'mm', to: 'in', round: 3 } }}</p>

Service

List of avialable measures (length, mass...)

export class YourClass {
  public constructor(private _unitsConverorService: UnitsConverorService) {
    this._unitsConverorService.measures() 
  }
}

Get description by unit name

{
    unitname: string;
    measure: string;
    system: string;
    definition: {
      name: {
        singular: 'Millimeter',
        plural: 'Millimeters'
      },
      to_anchor: 1 / 1000
    };
}
export class YourClass {
  public constructor(private _unitsConverorService: UnitsConverorService) {
    this._unitsConverorService.describe('mm') 
  }
}

Package Sidebar

Install

npm i ngx-units-converter

Weekly Downloads

25

Version

6.0.5

License

MIT

Unpacked Size

812 kB

Total Files

111

Last publish

Collaborators

  • limarenkodenis