fix wallets show

This commit is contained in:
Javier 2016-09-08 16:54:35 -03:00
commit b64d5dfbee

View file

@ -1,13 +1,15 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $ionicModal, $log, $timeout, addressbookService, profileService, lodash, $state, walletService, incomingData ) { angular.module('copayApp.controllers').controller('tabSendController', function($scope, $ionicModal, $log, $timeout, addressbookService, profileService, lodash, $state, walletService, incomingData) {
var originalList; var originalList;
$scope.init = function() { $scope.init = function() {
originalList = []; originalList = [];
var wallets = profileService.getWallets({onlyComplete: true}); var wallets = profileService.getWallets({
onlyComplete: true
});
lodash.each(wallets, function(v) { lodash.each(wallets, function(v) {
originalList.push({ originalList.push({
@ -29,13 +31,17 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
label: v, label: v,
address: k, address: k,
getAddress: function(cb) { getAddress: function(cb) {
return cb(null,k); return cb(null, k);
}, },
}); });
}); });
originalList = originalList.concat(contacts); originalList = originalList.concat(contacts);
$scope.list = lodash.clone(originalList); $scope.list = lodash.clone(originalList);
$timeout(function() {
$scope.$apply();
}, 1);
}); });
}; };
@ -62,13 +68,16 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
}; };
$scope.goToAmount = function(item) { $scope.goToAmount = function(item) {
item.getAddress(function(err,addr){ item.getAddress(function(err, addr) {
if (err|| !addr) { if (err || !addr) {
$log.error(err); $log.error(err);
return; return;
} }
$log.debug('Got toAddress:' + addr + ' | ' + item.label) $log.debug('Got toAddress:' + addr + ' | ' + item.label);
return $state.transitionTo('send.amount', { toAddress: addr, toName: item.label}) return $state.transitionTo('send.amount', {
toAddress: addr,
toName: item.label
})
}); });
}; };