1.1.2 • Published 3 years ago

angular-input-price-format v1.1.2

Weekly downloads
21
License
-
Repository
github
Last release
3 years ago

Input Price Format Directive

Transforms input to a currency string(with 2 digits).

Live Demo

You can see how it works here with Live Demo

Install

npm install angular-input-price-format --save

Usage

Add InputPriceFormatModule to your module's imports

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';

import { InputPriceFormatModule } from 'angular-input-price-format';

@NgModule({
  imports: [
      BrowserModule, 
      InputPriceFormatModule
    ],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
})

class AppModule {}

platformBrowserDynamic().bootstrapModule(AppModule);

And then use 'inputPrice' directive in your input tag component

import { Component } from '@angular/core';

@Component({
  selector: 'example-app',
  template: `
  <input inputPrice [(ngModel)]="exampleNumber" />
  `
})
export class AppComponent {
  exampleNumber = 2000;
}

License

MIT