angular-input-price-format
v1.1.2
Published
Transforms input to a currency string(with 2 digits).
Downloads
91
Maintainers
Readme
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;
}