https://github.com/salte-io/ng-currency
Currency with AngularJS made easy!
https://github.com/salte-io/ng-currency
angularjs currency
Last synced: 3 days ago
JSON representation
Currency with AngularJS made easy!
- Host: GitHub
- URL: https://github.com/salte-io/ng-currency
- Owner: salte-io
- License: mit
- Archived: true
- Created: 2014-05-08T18:42:17.000Z (over 11 years ago)
- Default Branch: main
- Last Pushed: 2022-05-04T20:34:44.000Z (over 3 years ago)
- Last Synced: 2025-09-06T08:22:34.512Z (about 1 month ago)
- Topics: angularjs, currency
- Language: JavaScript
- Homepage:
- Size: 2.16 MB
- Stars: 152
- Watchers: 4
- Forks: 70
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# ng-currency
[![NPM Version][npm-version-image]][npm-url]
[![NPM Downloads][npm-downloads-image]][npm-url]
[![CI Build][github-actions-image]][github-actions-url]
[![Coveralls][coveralls-image]][coveralls-url][![semantic-release][semantic-release-image]][semantic-release-url]
> `ng-currency` has officially entered [maintenance mode](https://github.com/salte-io/ng-currency/issues/205).
## Install
You can install this package either with `npm` or with `bower`.
## npm
```sh
$ npm install ng-currency
```Then add a `` to your index.html:
```html
<script src="/node_modules/ng-currency/dist/ng-currency.js">
```Or `require('ng-currency')` from your code.
## bower
```sh
$ bower install salte-io/ng-currency
```Then add a `` to your index.html:
```html
<script src="/bower_components/ng-currency/dist/ng-currency.js">
```## Example
[See it in action!](https://jsbin.com/pajuhaf/edit?html,output)
## ES6 Usage
**app.module.js**
```js
import angular from 'angular';
import ngCurrency from 'ng-currency';angular.module('my-app', [
ngCurrency // 'ng-currency'
]);
```**inside your angular app**
```html
```
## ES5 Usage
**index.html**
```html
var app = angular.module('my-app', [
'ng-currency'
]);app.controller('MainCtrl', function($scope) {
$scope.value = 123456.78;
});
```
## Bindings
### `min` / `max`
**Default:** `undefined`
**Description:** Specifies the range the `ng-model` value can be within for validation and `hard-cap`
```html
```
* If you want to be able to dynamically enable/disable validations from a controller you can use the following
```html
```
### `currency-symbol`
**Default:** Locale Currency Symbol
**Description:** Prefixes the formatted currency value with the currency symbol.
```html
```
### Active (`ng-currency`)
**Default:** `true`
**Description:** Dynamically disable / enable `ng-currency`.
```html
```
### `fraction`
**Default:** `2`
**Description:** Determines the number of decimal places.
```html
```
### `hard-cap`
**Default:** `false`
**Description:** Forces the `ng-model` value to stay within the `min` / `max` range.
```html
```
[npm-version-image]: https://img.shields.io/npm/v/ng-currency.svg?style=flat
[npm-downloads-image]: https://img.shields.io/npm/dm/ng-currency.svg?style=flat
[npm-url]: https://npmjs.org/package/ng-currency[github-actions-image]: https://github.com/salte-io/ng-currency/actions/workflows/ci.yml/badge.svg?branch=main
[github-actions-url]: https://github.com/salte-io/ng-currency/actions/workflows/ci.yml[coveralls-image]: https://img.shields.io/coveralls/salte-io/ng-currency/main.svg
[coveralls-url]: https://coveralls.io/github/salte-io/ng-currency[semantic-release-url]: https://github.com/semantic-release/semantic-release
[semantic-release-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg