angular.module("currencyJa", [])
  .controller("TradersCtrl", function ($scope, traderService) {
    $scope.base = 1;
    $scope.currency = "USD";
    $scope.traders = traderService.findByCurrency($scope.currency);

    $scope.multiplyByBase = function(amount) {
      var base = parseFloat($scope.base) ? $scope.base : 1
      return amount * base
    }

    $scope.changeCurrency = function(currency) {
      $scope.currency = currency;
      $scope.traders = traderService.findByCurrency($scope.currency);
    }
  })
  .service('traderService', function() {
    this.findByCurrency = function(currency) {
      var traders = []
      angular.forEach(gon.traders, function(trader, key) {
        traders.push({
          name: trader.name,
          buyCash: trader.currencies[currency]['buy_cash'],
          buyDraft: trader.currencies[currency]['buy_draft'],
          sellCash: trader.currencies[currency]['sell_cash'],
          sellDraft: trader.currencies[currency]['sell_draft']
        });
      });

      return traders;
    };
  });

$(function() {
  $('time').timeago();
});

angular.module("currencyJa", [])
  .controller("TradersCtrl", function ($scope, traderService) {
    $scope.currency = "USD";
    $scope.traders = traderService.findByCurrency($scope.currency);

    $scope.multiplyByBase = function(amount) {
      var base = parseFloat($scope.base) ? $scope.base : 1
      return amount * base
    }

    $scope.changeCurrency = function(currency) {
      $scope.currency = currency;
      $scope.traders = traderService.findByCurrency($scope.currency);
    }
  })
  .service('traderService', function() {
    this.findByCurrency = function(currency) {
      var traders = []
      angular.forEach(gon.traders, function(trader, key) {
        traders.push({
          name: trader.name,
          buyCash: trader.currencies[currency]['buy_cash'],
          buyDraft: trader.currencies[currency]['buy_draft'],
          sellCash: trader.currencies[currency]['sell_cash'],
          sellDraft: trader.currencies[currency]['sell_draft']
        });
      });

      return traders;
    };
  });

$(function() {
  $('time').timeago();
});

Remove intial value for base
Remove intial value for base
