optimizing address page

This commit is contained in:
Manuel Araoz 2014-04-30 12:25:33 -03:00
commit 4acb32c3d8
8 changed files with 52 additions and 44 deletions

View file

@ -3,21 +3,22 @@
angular.module('copay.addresses').controller('AddressesController',
function($scope, $rootScope, controllerUtils) {
$scope.title = 'Home';
$scope.oneAtATime = true;
$scope.addrBalance = {};
var w = $rootScope.wallet;
var _updateBalance = function () {
var _updateBalance = function() {
$scope.addrs = w.getAddressesStr(true);
controllerUtils.setSocketHandlers();
w.getBalance(true, function (balance, balanceByAddr, isMain) {
if (balanceByAddr && Object.keys(balanceByAddr).length) {
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.addrs = Object.keys(balanceByAddr);
$scope.selectedAddr = $scope.addrs[0];
$scope.loading = false;
$rootScope.$digest();
alert('digest');
}
});
};
@ -26,6 +27,7 @@ angular.module('copay.addresses').controller('AddressesController',
$scope.loading = true;
w.generateAddress();
_updateBalance();
alert('new address');
};
$scope.selectAddr = function(addr) {