-
Notifications
You must be signed in to change notification settings - Fork 38
/
app.js
51 lines (46 loc) · 2.08 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'use strict';
$.getJSON( "./config.json" , function( result ){
$(document).ready(function() {
angular.module('ethExplorer', ['ngRoute','ui.bootstrap', 'ethExplorer.search', 'ethExplorer.address', 'ethExplorer.tx', 'ethExplorer.main', 'ethExplorer.block'])
.config(['$routeProvider', '$locationProvider',
function($routeProvider, $locationProvider) {
$locationProvider.html5Mode(true);
$routeProvider.
when('/', {
templateUrl: 'views/main.html',
controller: 'mainCtrl'
}).
when('/block/:blockId', {
templateUrl: 'views/blockInfos.html',
controller: 'blockInfosCtrl'
}).
when('/transaction/:transactionId', {
templateUrl: 'views/transactionInfos.html',
controller: 'transactionInfosCtrl'
}).
when('/address/:addressId', {
templateUrl: 'views/addressInfo.html',
controller: 'addressInfoCtrl'
}).
otherwise({
redirectTo: '/'
});
}])
.run(function($rootScope) {
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider(result.rpcUrl));
$rootScope.web3 = web3;
$rootScope.safeApply = function(fn) {
var phase = this.$root.$$phase;
if(phase == '$apply' || phase == '$digest') {
if(fn && (typeof(fn) === 'function')) {
fn();
}
} else {
this.$apply(fn);
}
};
});
angular.bootstrap(document, ['ethExplorer']);
});
});