Giter Club home page Giter Club logo

isocurrency's Introduction

isoCurrency Build Status

AngularJS filter that retrieves currency symbols according to ISO 4217 currency codes.

Installation

  • npm install iso-currency
  • or bower install iso-currency
  • add 'isoCurrency' to your angular.module dependency, usually in app.js

Demo

http://jsfiddle.net/nqf0ye00/55/

Usage

Use to display a value with a currency symbol

Instead of directly using the currency symbol, you only need the 3 char long currency code (e.g. USD or JPY). It will take the right symbol, format and fraction size. The latter can be overridden by providing an explicity fraction size value after the currency field (see below).

// in controller
$scope.amount = 50.50;
$scope.currency = 'USD';

// in template
{{ amount | isoCurrency:currency }} // $50.50
{{ amount | isoCurrency:currency:0 }} // $50

Use to display a currency symbol based on a currency code

If you need the currency symbol only, you can just additionally add isoCurrency.common in your app.js, and then you can use iso4217.getCurrencyByCode() method directly.

currency = iso4217.getCurrencyByCode('EUR')
currency == {text: "Euro", fraction: 2, symbol: "€"}

This will return an object so that you just specify currency.symbol to access the symbol value.

Contribute and test

  • gulp watch and get started
  • gulp && testem ci to start the tests

## Currency reference

Mainly taken from the list of https://en.wikipedia.org/wiki/ISO_4217. If something is missing, feel free to create a PR.

isocurrency's People

Contributors

simon-wicki avatar zwacky avatar jacquesdev avatar kunalpowar avatar nedyalkov avatar demisx avatar guillaumeparis2000 avatar hemstreet avatar lloydwatkin avatar michelem09 avatar philbrown avatar dependabot[bot] avatar liormar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.