Merge pull request #437 from colkito/fix/address-list-selected-item

Fix/address list selected item
This commit is contained in:
Gustavo Maximiliano Cortez 2014-05-20 14:40:58 -03:00
commit 8de18364ba
3 changed files with 11 additions and 11 deletions

View file

@ -1,23 +1,24 @@
'use strict';
angular.module('copay.addresses').controller('AddressesController',
function($scope, $rootScope, controllerUtils) {
function($scope, $rootScope, $timeout, controllerUtils) {
$scope.loading = false;
var w = $rootScope.wallet;
$scope.newAddr = function() {
$scope.loading=true;
$scope.loading = true;
w.generateAddress(null, function() {
setTimeout(function() {
$timeout(function() {
controllerUtils.setSocketHandlers();
controllerUtils.updateAddressList();
$scope.loading=false;
$rootScope.selectedAddr = $rootScope.addrInfos[0].address.toString();
$scope.loading = false;
$rootScope.$digest();
},1);
});
};
$scope.selectAddr = function(addr) {
$scope.selectedAddr = addr;
$scope.selectAddr = function (addr) {
return addr === $rootScope.selectedAddr ? 'selected' : '';
};
});