2014-03-26 09:18:42 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
2014-04-20 20:21:54 -03:00
|
|
|
angular.module('copay.addresses').controller('AddressesController',
|
2014-05-19 17:51:21 -03:00
|
|
|
function($scope, $rootScope, $timeout, controllerUtils) {
|
2014-04-30 19:50:13 -03:00
|
|
|
$scope.loading = false;
|
2014-05-16 18:33:06 -03:00
|
|
|
var w = $rootScope.wallet;
|
2014-05-19 17:51:21 -03:00
|
|
|
|
2014-04-14 16:48:12 -03:00
|
|
|
$scope.newAddr = function() {
|
2014-05-19 17:51:21 -03:00
|
|
|
$scope.loading = true;
|
2014-05-16 18:33:06 -03:00
|
|
|
w.generateAddress(null, function() {
|
2014-05-19 17:51:21 -03:00
|
|
|
$timeout(function() {
|
2014-05-16 18:33:06 -03:00
|
|
|
controllerUtils.setSocketHandlers();
|
|
|
|
|
controllerUtils.updateAddressList();
|
2014-05-19 17:51:21 -03:00
|
|
|
$rootScope.selectedAddr = $rootScope.addrInfos[0].address.toString();
|
|
|
|
|
$scope.loading = false;
|
2014-05-16 18:33:06 -03:00
|
|
|
$rootScope.$digest();
|
|
|
|
|
},1);
|
2014-05-09 16:02:27 -03:00
|
|
|
});
|
2014-04-14 16:48:12 -03:00
|
|
|
};
|
|
|
|
|
|
2014-05-19 17:51:21 -03:00
|
|
|
$scope.selectAddr = function (addr) {
|
|
|
|
|
return addr === $rootScope.selectedAddr ? 'selected' : '';
|
2014-04-14 16:48:12 -03:00
|
|
|
};
|
2014-03-26 09:18:42 -03:00
|
|
|
});
|