2016-06-10 15:16:02 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
2016-08-09 09:57:40 -03:00
|
|
|
angular.module('copayApp.controllers').controller('walletsController', function($scope, $timeout, bwcError, profileService) {
|
2016-06-10 15:16:02 -03:00
|
|
|
|
2016-06-16 21:49:35 -03:00
|
|
|
$scope.selectWallet = function(walletId) {
|
2016-06-16 18:29:56 -03:00
|
|
|
|
|
|
|
|
var client = profileService.getClient(walletId);
|
|
|
|
|
$scope.errorSelectedWallet = {};
|
|
|
|
|
|
|
|
|
|
profileService.isReady(client, function(err) {
|
2016-07-11 11:46:48 -03:00
|
|
|
if (err) {
|
|
|
|
|
$scope.errorSelectedWallet[walletId] = bwcError.msg(err);
|
2016-08-09 09:57:40 -03:00
|
|
|
$timeout(function() {
|
|
|
|
|
$scope.$apply();
|
|
|
|
|
});
|
2016-06-16 18:29:56 -03:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-16 21:42:44 -03:00
|
|
|
$scope.$emit('walletSelected', walletId);
|
2016-06-16 18:29:56 -03:00
|
|
|
});
|
2016-06-10 15:16:02 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.cancel = function() {
|
|
|
|
|
$scope.walletsModal.hide();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
});
|