2016-06-10 15:16:02 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
angular.module('copayApp.controllers').controller('walletsController', function($scope, bwsError, profileService) {
|
|
|
|
|
|
|
|
|
|
$scope.selectWallet = function(walletId, walletName) {
|
2016-06-16 18:29:56 -03:00
|
|
|
|
|
|
|
|
var client = profileService.getClient(walletId);
|
|
|
|
|
$scope.errorSelectedWallet = {};
|
|
|
|
|
|
|
|
|
|
profileService.isReady(client, function(err) {
|
|
|
|
|
if (err) {
|
|
|
|
|
$scope.errorSelectedWallet[walletId] = bwsError.msg(err);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var obj = {
|
|
|
|
|
'walletId': walletId,
|
|
|
|
|
'walletName': walletName,
|
|
|
|
|
'client': profileService.getClient(walletId)
|
|
|
|
|
}
|
|
|
|
|
$scope.$emit('walletSelected', obj);
|
|
|
|
|
});
|
2016-06-10 15:16:02 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.cancel = function() {
|
|
|
|
|
$scope.walletsModal.hide();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
});
|