Cleaning controllers. Also call connect socket-ii in all pages. Everything work!

This commit is contained in:
Gustavo Cortez 2014-04-17 13:25:36 -03:00
commit 8ab479691d
6 changed files with 68 additions and 46 deletions

View file

@ -1,12 +1,12 @@
'use strict';
angular.module('copay.home').controller('HomeController',
function($scope, $rootScope, $location) {
function($scope, $rootScope, $location, Socket, controllerUtils) {
$scope.title = 'Home';
$scope.oneAtATime = true;
$scope.addrBalance = {};
var _getBalance = function() {
$scope.addrs.forEach(function(addr) {
$rootScope.wallet.blockchain.listUnspent([addr], function(unspent) {
@ -24,6 +24,9 @@ angular.module('copay.home').controller('HomeController',
$scope.selectedAddr = $scope.addrs[0];
_getBalance();
var socket = Socket($scope);
socket.on('connect', controllerUtils.handleTransactionByAddress($scope));
}
$scope.newAddr = function() {
@ -31,6 +34,8 @@ angular.module('copay.home').controller('HomeController',
$scope.addrs.push(a);
_getBalance();
var socket = Socket($scope);
socket.on('connect', controllerUtils.handleTransactionByAddress($scope));
};
$scope.selectAddr = function(addr) {