From 7340b4af29f56746de4e8c3ca515695077864c2a Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 11 Dec 2014 21:17:49 -0300 Subject: [PATCH] loading after click on send button --- js/controllers/send.js | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/js/controllers/send.js b/js/controllers/send.js index d9cfb9b7f..82b278b25 100644 --- a/js/controllers/send.js +++ b/js/controllers/send.js @@ -145,26 +145,29 @@ angular.module('copayApp.controllers').controller('SendController', } $scope.loading = true; - var comment = form.comment.$modelValue; - var merchantData = $scope._merchantData; - var address, amount; - if (!merchantData) { - address = form.address.$modelValue; - amount = parseInt((form.amount.$modelValue * unitToSat).toFixed(0)); - } - w.spend({ - merchantData: merchantData, - toAddress: address, - amountSat: amount, - comment: comment, - }, function(err, txid, status) { - $scope.loading = false; - if (err) + $timeout(function() { + var comment = form.comment.$modelValue; + var merchantData = $scope._merchantData; + var address, amount; + if (!merchantData) { + address = form.address.$modelValue; + amount = parseInt((form.amount.$modelValue * unitToSat).toFixed(0)); + } + + w.spend({ + merchantData: merchantData, + toAddress: address, + amountSat: amount, + comment: comment, + }, function(err, txid, status) { + $scope.loading = false; + if (err) return $scope.setError(err); txStatus.notify(status); $scope.resetForm(); - }); + }); + }, 100); }; // QR code Scanner