Improves updating addressbook
This commit is contained in:
parent
c7f09f5e86
commit
18e5d9f615
2 changed files with 11 additions and 6 deletions
|
|
@ -1011,7 +1011,12 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
|
||||
};
|
||||
|
||||
self.setAddressbook = function() {
|
||||
self.setAddressbook = function(ab) {
|
||||
if (ab) {
|
||||
self.addressbook = ab;
|
||||
return;
|
||||
}
|
||||
|
||||
addressbookService.list(function(err, ab) {
|
||||
if (err) {
|
||||
$log.error('Error getting the addressbook');
|
||||
|
|
@ -1027,8 +1032,8 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.updateHistory();
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/AddressbookUpdated', function(event) {
|
||||
self.setAddressbook();
|
||||
$rootScope.$on('Local/AddressbookUpdated', function(event, ab) {
|
||||
self.setAddressbook(ab);
|
||||
});
|
||||
|
||||
// UX event handlers
|
||||
|
|
@ -1286,4 +1291,4 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.setFocusedWallet();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
$scope.error = err;
|
||||
return;
|
||||
}
|
||||
$rootScope.$emit('Local/AddressbookUpdated');
|
||||
$rootScope.$emit('Local/AddressbookUpdated', ab);
|
||||
$scope.list = ab;
|
||||
$scope.editAddressbook = true;
|
||||
$scope.toggleEditAddressbook();
|
||||
|
|
@ -231,7 +231,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
$scope.error = err;
|
||||
return;
|
||||
}
|
||||
$rootScope.$emit('Local/AddressbookUpdated');
|
||||
$rootScope.$emit('Local/AddressbookUpdated', ab);
|
||||
$scope.list = ab;
|
||||
$scope.$digest();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue