# angular-currency-name

> An angular filter that lets you input the shortname of any of the world currencies and then suffixes or prefixes the amount with the symbol.

Latest version **1.0.0** (published 2017-05-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install angular-currency-name
pnpm add angular-currency-name
yarn add angular-currency-name
bun add angular-currency-name
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-05-15 |
| First published | 2017-05-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | iamAfro |
| Maintainers | iamafro |
| Keywords | angular, currency |

## Links

- npm: https://www.npmjs.com/package/angular-currency-name
- Repository: https://github.com/HackAfro/ngCurrencyName
- Homepage: https://github.com/HackAfro/ngCurrencyName#readme
- Issues: https://github.com/HackAfro/ngCurrencyName/issues
- npm.io page: https://npm.io/package/angular-currency-name

## Recent versions

- 1.0.0 (latest) — 2017-05-15

## README

# Angular Currency Name
Formats an input using the shortname of any of the world currencies provided. 

## Description
An angular filter that formats an input using the shortname of any of the world currencies provided, then suffixes or prefixes the input with the symbol. 
When no currency symbol is provided, default symbol for current locale is used.
Formats input as currency (e.g ₦12,3445, 12,450.00₦)

## Usage

### In HTML Template Binding
    {{ currency_expression | currencyName:shortName[:decimalPoints[:suffixSymbol]] }}

### In Controller
    $filter('currency')(amount, shortName[, decimalPoints[, suffixSymbol]])

#### Paramaters

Param         | Type    | Details
:-----------  | :------ | :------
amount        | number  | Input to filter.
shortName     | string  | Short name of currency to be displayed. e.g 'naira', 'euro', 'dollar' Falls back to [ng.$locale](https://code.angularjs.org/1.2.1/docs/api/ng.$locale).
decimalPoints | number  | Number of decimal places to round the number to. Falls back to [ng.$locale](https://code.angularjs.org/1.2.1/docs/api/ng.$locale)
suffixSymbol  | boolean or string | If set to true the currency symbol will be placed after the amount.

#### Returns

String: Formatted number.

### Use cases in controllers

    // With all parameters
    expect(currency(1234.4239, 'naira', 1, true)).toEqual('1,234.4₦');

    // Parameters without suffix
    expect(currency(1234.4239, 'pound', 2)).toEqual('€1,234.42');

    // With missing fraction size
    expect(currency(1234.4239, 'dollar', true)).toEqual('1,234.42$');

    // With fraction size only
    expect(currency(1234.4239, 'baht', 3)).toEqual('฿1,234.424');

    // Only with symbol
    expect(currency(1234.4239, 'naira')).toEqual('₦1,234.42');

### Example

#### HTML Template Binding

    <span ng-bind="price | currencyName:'pound':true"></span> <!-- 1234.42€ -->
    <span ng-bind="price | currency:'naira': 3"></span> <!-- ₦1234.423-->

#### JavaScript

    angular.module('app', ['ngCurrencyName']).
        controller('Ctrl', function ( $scope, $filter ) {
            var currency = $filter('currencyName');
            $scope.price = currency(1234.4239, 'pound', 0, true); // 1234€
            $scope.price = currency(1234.4239, 'dollar', 2, false); // $1234.42
        });


## Install

### Via bower

    bower install --save angular-currency-name

Include `src/angular-currency-name.js` or `dist/angular-currency-name.min.js` to your project.

    <script src="/bower_components/angular-currency-name/dist/angular-currency-name.min.js"></script>

Don't forget to add `ngCurrencyName` module to your app's dependecies.

### List of available currencies

Short Name   | Symbol
:----------- | :-----
Afghani      |   ؋
Baht         |   ฿
Balboa       |   B/.
BeliDollar   |   BZ$
Bolivar      |   Bs
Bolíviano    |   $b
Cedi         |   ¢
Colon        |   $
Cordoba      |   C$
Euro         |   €
Denar        |   ден
Dinar        |   Дин
Dollar       |   $
DomPeso      |   RD$
Dong         |   ₫
Forint       |   Ft
Franc        |   CHF
Guarani      |   Gs
Guilder      |   ƒ
Hryvnia      |   ₴
IndiaRupee   |   ₹
Jdollar      |   J$
Kip          |   ₭
Koruna       |   Kč
Krona        |   kr
Krone        |   kr
Kuna         |   kn
Lek          |   Lek
Lempira      |   L
Leu          |   lei
Lev          |   лв
Lira         |   ₺
Manat        |   ман
Marka        |   KM
Metical      |   MT
Naira        |   ₦
NewDollar    |   NT$
Peso         |   $
PhilPeso     |   ₱
Pound        |   £
Pula         |   P
Quetzal      |   Q
Rand         |   R
Real         |   R$
Rial         |   ﷼
Riel         |   ៛
Ringgit      |   RM
Riyal        |   ﷼ 
Ruble        |   ₽
Rupee        |   ₨
Rupiah       |   Rp
Shekel       |   ₪
Shilling     |   S
Sol          |   S/.
Som          |   лв
Tenge        |   лв
TTD          |   TT$
Tughrik      |   ₮
UruPeso      |   $U
Won          |   ₩
Yen          |   ¥
Yuan         |   ¥
ZimDollar    | 	 Z$
Zloty        |   zł

## Pull requests
If I've missed out on any currency or you think I made a mistake in any of the available currencies, please send a pull request. More ideas are welcome.

## License
MIT License

---
_Source: https://npm.io/package/angular-currency-name · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
