From 7529a629b8fc0149a3902977c62127a441513ec4 Mon Sep 17 00:00:00 2001 From: Esteban Ordano Date: Fri, 29 Aug 2014 14:06:20 -0300 Subject: [PATCH] Fixes send controller --- js/controllers/send.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/js/controllers/send.js b/js/controllers/send.js index c82ed9280..3dc673183 100644 --- a/js/controllers/send.js +++ b/js/controllers/send.js @@ -32,13 +32,14 @@ angular.module('copayApp.controllers').controller('SendController', return this._alternative; }, set: function (newValue) { - newValue = -(-newValue) || 0; this._alternative = newValue; - if ($scope.isRateAvailable) { + if (typeof(newValue) === 'number' && $scope.isRateAvailable) { this._amount = Number.parseFloat( (rateService.fromFiat(newValue, config.alternativeIsoCode) * satToUnit ).toFixed(config.unitDecimals), 10); - }; + } else { + this._amount = 0; + } }, enumerable: true, configurable: true @@ -49,13 +50,14 @@ angular.module('copayApp.controllers').controller('SendController', return this._amount; }, set: function (newValue) { - newValue = -(-newValue) || 0; this._amount = newValue; - if ($scope.isRateAvailable) { + if (typeof(newValue) === 'number' && $scope.isRateAvailable) { this._alternative = Number.parseFloat( (rateService.toFiat(newValue * config.unitToSatoshi, config.alternativeIsoCode) ).toFixed(2), 10); - }; + } else { + this._alternative = 0; + } }, enumerable: true, configurable: true