added watch for .wallet

This commit is contained in:
Ivan Socolsky 2015-01-04 12:10:53 -03:00
parent 5dffcf79c9
commit 458f2b0638
1 changed files with 11 additions and 6 deletions

View File

@ -1,14 +1,19 @@
'use strict';
var watching;
angular.module('copayApp.controllers').controller('HomeWalletController', function($scope, $rootScope, $timeout, $filter, $modal, rateService, notification, txStatus, identityService) {
$scope.initHome = function() {
$rootScope.title = 'Home';
var w = $rootScope.wallet;
$scope.isShared = w.isShared();
$scope.requiresMultipleSignatures = w.requiresMultipleSignatures();
if ($scope.isShared)
$scope.copayers = w.getRegisteredPeerIds();
};
if (!watching) {
watching = $rootScope.$watch('wallet', function (w) {
$scope.isShared = w.isShared();
$scope.requiresMultipleSignatures = w.requiresMultipleSignatures();
if ($scope.isShared)
$scope.copayers = w.getRegisteredPeerIds();
});
}
};
$scope.openTxModal = function(tx) {
var ModalInstanceCtrl = function($scope, $modalInstance) {