refactor isChange logic
This commit is contained in:
parent
4acb32c3d8
commit
fd9e6cb48a
8 changed files with 89 additions and 66 deletions
|
|
@ -2,38 +2,21 @@
|
|||
|
||||
angular.module('copay.addresses').controller('AddressesController',
|
||||
function($scope, $rootScope, controllerUtils) {
|
||||
$scope.title = 'Home';
|
||||
$scope.addrBalance = {};
|
||||
|
||||
var w = $rootScope.wallet;
|
||||
|
||||
var _updateBalance = function() {
|
||||
$scope.addrs = w.getAddressesStr(true);
|
||||
controllerUtils.setSocketHandlers();
|
||||
w.getBalance(true, function(balance, balanceByAddr, isMain) {
|
||||
if (balanceByAddr && Object.keys(balanceByAddr).length) {
|
||||
$rootScope.balanceByAddr = balanceByAddr;
|
||||
$scope.isMain = isMain;
|
||||
$scope.addrs = Object.keys(balanceByAddr);
|
||||
$scope.selectedAddr = $scope.addrs[0];
|
||||
$scope.loading = false;
|
||||
$rootScope.$digest();
|
||||
alert('digest');
|
||||
}
|
||||
});
|
||||
};
|
||||
$scope.loading = false;
|
||||
|
||||
$scope.newAddr = function() {
|
||||
$scope.loading = true;
|
||||
w.generateAddress();
|
||||
_updateBalance();
|
||||
alert('new address');
|
||||
controllerUtils.updateBalance(function() {
|
||||
$scope.loading = false;
|
||||
$rootScope.$digest();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.selectAddr = function(addr) {
|
||||
$scope.selectedAddr = addr;
|
||||
};
|
||||
|
||||
_updateBalance();
|
||||
w.on('refresh', _updateBalance);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -40,7 +40,13 @@ angular.module('copay.header').controller('HeaderController',
|
|||
w.disconnect();
|
||||
controllerUtils.logout();
|
||||
}
|
||||
$rootScope.flashMessage = {};
|
||||
$scope.clearFlashMessage();
|
||||
};
|
||||
|
||||
$scope.refresh = function() {
|
||||
controllerUtils.updateBalance(function() {
|
||||
$rootScope.$digest();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.clearFlashMessage = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue