diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index e6913a2cb..8438260bc 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -70,7 +70,6 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory, initCurrencies(); passthroughParams = data.stateParams; - console.log('stateParams:', data.stateParams); vm.fromWalletId = data.stateParams.fromWalletId; vm.toWalletId = data.stateParams.toWalletId; @@ -90,7 +89,6 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory, vm.toWallet = profileService.getWallet(vm.toWalletId); shapeshiftService.getMarketData(vm.fromWallet.coin, vm.toWallet.coin, function(data) { - console.log(data); vm.thirdParty.data['minAmount'] = vm.minAmount = parseFloat(data.minimum); vm.thirdParty.data['maxAmount'] = vm.maxAmount = parseFloat(data.maxLimit); }); @@ -472,8 +470,6 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory, confirmData['thirdParty'] = JSON.stringify(this.thirdParty); } - console.log('confirmData:', confirmData); - if (!confirmData.fromWalletId) { $state.transitionTo('tabs.paymentRequest.confirm', confirmData); } else { @@ -594,20 +590,19 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory, if (passthroughParams.fromWalletId && availableSatoshis !== null) { availableFundsInFiat = ''; vm.availableFunds = availableFundsInCrypto; - var coin = availableUnits[altUnitIndex].isFiat ? availableUnits[unitIndex].id : availableUnits[altUnitIndex].id; - txFormatService.formatAlternativeStr(coin, availableSatoshis, function formatCallback(formatted){ - if (formatted) { - availableFundsInFiat = formatted; - $scope.$apply(function() { - if (availableUnits[unitIndex].isFiat) { + if (availableUnits[unitIndex].isFiat) { + var coin = availableUnits[altUnitIndex].id; + txFormatService.formatAlternativeStr(coin, availableSatoshis, function formatCallback(formatted){ + if (formatted) { + availableFundsInFiat = formatted; + + $scope.$apply(function() { vm.availableFunds = availableFundsInFiat; - } else { - vm.availableFunds = availableFundsInCrypto; - } - }); - } - }); + }); + } + }); + } } } diff --git a/src/js/directives/formattedAmount.js b/src/js/directives/formattedAmount.js index c5b2dfcd4..b75f1ec22 100644 --- a/src/js/directives/formattedAmount.js +++ b/src/js/directives/formattedAmount.js @@ -63,14 +63,15 @@ angular.module('bitcoincom.directives') }; var formatNumbers = function() { - - if (!$scope.currency && $scope.value) { // If there is no currency available.. - // Try to extract currency from value.. - var currencySplit = $scope.value.split(" "); - if (currencySplit.length === 2) { - $scope.currency = currencySplit[1]; - } + console.log('formatNumbers("' + $scope.value + '", "' + $scope.currency + '")'); + // During watch, may be changed from having a separate currency value, + // to both being in value. Don't want to use previous currency value. + // Try to extract currency from value.. + var currencySplit = $scope.value.split(" "); + if (currencySplit.length === 2) { + $scope.currency = currencySplit[1]; } + var parsed = parseFloat($scope.value); var valueFormatted = ''; diff --git a/www/views/amount.html b/www/views/amount.html index 9db5d189d..57a8e46ce 100644 --- a/www/views/amount.html +++ b/www/views/amount.html @@ -44,7 +44,7 @@
- Available Funds: + Available Funds: