-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
64 lines (56 loc) · 1.88 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
52
53
54
55
56
57
58
59
60
61
62
63
64
angular.module('myApp', ['ngRoute', 'ui.bootstrap', 'chart.js', 'angular-bootstrap-select']);
angular.module('myApp').config(function ($routeProvider) {
$routeProvider
.when('/',
{
controller : 'ItemsCtrl',
templateUrl: 'views/items.html'
})
.when('/champions',
{
controller : 'ChampionsCtrl',
templateUrl: 'views/champions.html'
})
.when('/champions/:id',
{
controller : 'ChampionsDetailCtrl',
templateUrl: 'views/championsDetails.html'
})
.otherwise({redirectTo: '/'});
})
.config(function(ChartJsProvider){
ChartJsProvider.setOptions({colours: [
'#9333f9', //purple
'#97BBCD', // blue
'#F7464A', // red
'#46BFBD', // green
'#FDB45C', // yellow
'#949FB1', // grey
'#4D5360' // dark grey
]});
})
.run(function(ChartSvc){
ChartSvc.loadJsons();
})
.directive('fixedHeight', function($window, $timeout){
return{
link: function(scope, elem, attrs){
$($window).on('resize', function() {
$timeout(function(){
var height = $(elem).find(attrs.fixedHeight).innerHeight();
if(attrs.extraItem)
height += $(elem).find(attrs.extraItem).innerHeight();
$(elem).css('height', height + 'px');
}, 80);
});
scope.$on('create', function (event, chart) {
$($window).trigger('resize');
});
}
}
})
.controller('NavbarCtrl', function($scope, $location){
$scope.isActive = function (viewLocation) {
return viewLocation === $location.path();
};
});