JSFiddle - React, Tailwind, and code Playground

by Avi Algaly

HTML

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<div ng-app="example">
    <div ng-controller="AppCtrl">
        <div class="container">
            <h1>iso-currency <small>examples</small></h1>
            <div class="form-group">
                <label for="amount">Currency amount</label>
                <input type="text" class="form-control" id="amount" placeholder="Enter amount" ng-model="amount" />
            </div>
        </div>
        <div class="container" ng-repeat="currency in currencies">
            <div class="col-xs-2">{{ currency }}:</div>
            <div class="col-xs-10">{{ amount | isoCurrency:currency }}</div>
        </div>
    </div>
</div>

JavaScript

angular.module('example', [
    'isoCurrency'
])

.controller('AppCtrl', function($scope) {
    $scope.amount = 15.23;
    $scope.currencies = ['EUR', 'USD', 'JPY', 'OMR'];
});



'use strict';

/**
 * holds utility services.
 */
angular.module('isoCurrency.common', [])
	.factory('iso4217', function() {
		
		var currencies = {
			'AFN': {
				text: 'Afghani',
				fraction: 2,
				symbol: '؋'
			},
			'EUR': {
				text: 'Euro',
				fraction: 2,
				symbol: '€'
			},
			'ALL': {
				text: 'Lek',
				fraction: 2,
				symbol: 'Lek'
			},
			'DZD': {
				text: 'Algerian Dinar',
				fraction: 2,
				symbol: false
			},
			'USD': {
				text: 'US Dollar',
				fraction: 2,
				symbol: '$'
			},
			'AOA': {
				text: 'Kwanza',
				fraction: 2,
				symbol: false
			},
			'XCD': {
				text: 'East Caribbean Dollar',
				fraction: 2,
				symbol: '$'
			},
			'ARS': {
				text: 'Argentine Peso',
				fraction: 2,
				symbol: '$'
			},
			'AMD': {
				text: 'Armenian Dram',
				fraction: 2,
				symbol: false
			},
			'AWG': {
				text: 'Aruban Florin',
				fraction: 2,
				symbol: 'ƒ'
			},
			'AUD': {
				text: 'Australian Dollar',
				fraction: 2,
				symbol: '$'
			},
			'AZN': {
				text: 'Azerbaijanian Manat',
				fraction: 2,
				symbol: 'ман'
			},
			'BSD': {
				text: 'Bahamian Dollar',
				fraction: 2,
				symbol: '$'
			},
			'BHD': {
				text: 'Bahraini Dinar',
				fraction: 3,
				symbol: false
			},
			'BDT': {
				text: 'Taka',
				fraction: 2,
				symbol: false
			},
			'BBD': {
				text: 'Barbados Dollar',
				fraction: 2,
				symbol: '$'
			},
			'BYR': {
				text: 'Belarussian Ruble',
				fraction: 0,
				symbol: 'p.'
			},
			'BZD': {
				text: 'Belize Dollar',
				fraction: 2,
				symbol: 'BZ$'
			},
			'XOF': {
				text: 'CF Franc BCEAO',
				fraction: 0,
				symbol: false
			},
			'BMD': {
				text: 'Bermudian Dollar',
				fraction: 2,
				symbol: '$'
			},
			'BTN': {
				text: 'Ngultrum',
				fraction: 2,
				symbol: false
			},
			'INR': {
				text:...