Skip to content

jstroem/ng-input-currency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ng-input-currency

Build Status Coverage Status npm

Angular directive for formatting inputs as currency fields. This repo is inspired by format-as-currency.

Demo

http://jstroem.github.io/ng-input-currency/demo

Installation

Install via bower or NPM:

  • Bower: bower install --save ng-input-currency
  • NPM: npm install --save ng-input-currency

Usage

<div ng-controller="myController">
  <input ng-input-currency ng-model="value" type="text">
</div>

<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/format-as-currency/format-as-currency.js"></script>
<script>
  angular
  .module('myModule', ['ngInputCurrency'])
  .controller('myController', function ($scope) {
    $scope.value = '' // currency input value
  });
</script>

With a module loader

Browserify

var formatAsCurrency = require('ng-input-currency')
angular.module('myModule', [ngInputCurrency])

Rollup

import * as ngInputCurrency from 'ng-input-currency'
angular.module('myModule', [ngInputCurrency])

Webpack

var ngInputCurrency = require('ng-input-currency')
angular.module('myModule', [ngInputCurrency])

Running the tests

npm test

Contributing

Contributions are welcome!