working with events

This commit is contained in:
Matias Alejo Garcia 2014-11-30 00:44:25 -03:00
commit 494c21132a
4 changed files with 26 additions and 10 deletions

View file

@ -44,14 +44,30 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
$scope.init = function() {
// Change focused wallet
if ($rootScope.wallet) {
$rootScope.$watch('wallet', function() {
$scope.walletSelection = false;
$scope.setWallets();
});
}
};
// Change wallet list
if ($rootScope.iden) {
var iden = $rootScope.iden;
iden.on('newWallet', function() {
$scope.walletSelection = false;
$scope.setWallets();
});
iden.on('deleteWallet', function() {
$scope.walletSelection = false;
$scope.setWallets();
});
}
};
$scope.setWallets = function() {
if (!$rootScope.iden) return;