From d81f194f87a262d4de7b43e2fa3401c7cdc52017 Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Thu, 9 Aug 2018 07:35:47 +1200 Subject: [PATCH] Fix for when an amount changes from having a separate currency value, to the currency being one string with the amount. --- src/js/directives/formattedAmount.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/js/directives/formattedAmount.js b/src/js/directives/formattedAmount.js index c5b2dfcd4..c39007d66 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]; - } + + // 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 = '';