Wallet/js/controllers/header.js
Gustavo Cortez eaa1bc37e0 Initial getBalance of all your addresses. Socket-io that listening if your address receives btc.
Known bug: if you add new the address you can to recall socket-io. Socket-io should be listening on headerController.
2014-04-17 06:43:30 -03:00

53 lines
1.2 KiB
JavaScript

'use strict';
angular.module('copay.header').controller('HeaderController',
function($scope, $rootScope, $location, walletFactory, Socket) {
$scope.menu = [{
'title': 'Home',
'icon': 'fi-home',
'link': '#/home'
}, {
'title': 'Copayers',
'icon': 'fi-torsos-all',
'link': '#/peer'
}, {
'title': 'Transactions',
'icon': 'fi-loop',
'link': '#/transactions'
}, {
'title': 'Send',
'icon': 'fi-arrow-right',
'link': '#/send'
}, {
'title': 'Backup',
'icon': 'fi-archive',
'link': '#/backup'
}];
if (!$rootScope.wallet || !$rootScope.wallet.id) {
$location.path('signin');
}
$scope.isActive = function(item) {
if (item.link && item.link.replace('#','') == $location.path()) {
return true;
}
return false;
};
$scope.signout = function() {
var w = $rootScope.wallet;
if (w) {
w.disconnect();
delete $rootScope['wallet'];
var socket = Socket($scope);
socket.removeAllListeners();
$location.path('signin');
}
};
$scope.clearFlashMessage = function() {
$rootScope.flashMessage = {};
};
});