UNPKG

insight-ui-excc

Version:

An open-source frontend for the Insight API compatible with Exchangecoin. The Insight API provides you with a convenient, powerful and simple way to query and broadcast data on the Exchangecoin network and build your own services with it.

53 lines (44 loc) 1.15 kB
'use strict'; angular.module('insight.system').controller('HeaderController', function($scope, $rootScope, $modal, getSocket, Global, Block) { $scope.global = Global; $rootScope.currency = { factor: 1, bitstamp: 0, testnet: testnet, netSymbol: netSymbol, symbol: netSymbol }; $scope.menu = [{ 'title': 'Blocks', 'link': 'blocks' }, { 'title': 'Charts', 'link': 'charts' }, { 'title': 'Status', 'link': 'status' }]; $scope.openScannerModal = function() { var modalInstance = $modal.open({ templateUrl: 'scannerModal.html', controller: 'ScannerController' }); }; var _getBlock = function(hash) { Block.get({ blockHash: hash }, function(res) { $scope.totalBlocks = res.height; }); }; var socket = getSocket($scope); socket.on('connect', function() { socket.emit('subscribe', 'inv'); socket.on('block', function(block) { var blockHash = block.toString(); _getBlock(blockHash); }); }); $rootScope.isCollapsed = true; });