* Reload address list when click on refresh
* Angular error when do not have any address and click on refresh
This commit is contained in:
Gustavo Cortez 2014-05-21 18:53:17 -03:00
commit 61dfec7a0d
4 changed files with 17 additions and 14 deletions

View file

@ -20,12 +20,13 @@ angular.module('copay.addresses').controller('AddressesController',
$scope.selectedAddr = addr;
};
$rootScope.$watch('addrInfos', function(addrInfos) {
$scope.addressList(addrInfos);
$rootScope.$watch('addrInfos', function() {
$scope.addressList();
});
$scope.addressList = function (addrInfos) {
$scope.addressList = function () {
$scope.addresses = [];
var addrInfos = $rootScope.addrInfos;
if (addrInfos) {
for(var i=0;i<addrInfos.length;i++) {
var addrinfo = addrInfos[i];
@ -36,6 +37,8 @@ angular.module('copay.addresses').controller('AddressesController',
});
}
$scope.selectedAddr = $scope.addresses[0];
$scope.addrWithFund = $rootScope.receivedFund ? $rootScope.receivedFund[1] : null;
$rootScope.receivedFund = null;
}
}

View file

@ -63,9 +63,11 @@ angular.module('copay.header').controller('HeaderController',
$scope.refresh = function() {
var w = $rootScope.wallet;
w.connectToAll();
controllerUtils.updateBalance(function() {
$rootScope.$digest();
});
if ($rootScope.addrInfos.length > 0 ) {
controllerUtils.updateBalance(function() {
$rootScope.$digest();
});
}
};
$scope.clearFlashMessage = function() {