-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
81 lines (65 loc) · 2.64 KB
/
demo.html
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!doctype html>
<html ng-app="app">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Angular Countdown Demo</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">
<!-- REQUIRED 1/3 - AngularJS Core -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
<!-- DEMO APP INIT -->
<script>
(function() {
angular.module('app', []);
angular.module('app').controller('demoController', demoController);
demoController.$inject = ['$scope'];
function demoController($scope) {
var vm = this;
vm.tomorrow = new Date();
vm.tomorrow.setHours(24,0,0,0); // midnight tomorrow
vm.xmas = new Date();
vm.xmas.setMonth(11);
vm.xmas.setDate(25);
vm.xmas.setHours(0,0,0,0); // midnignt
vm.expired = {};
vm.expiring = new Date();
vm.expiring.setTime(vm.expiring.getTime() + 1000 * 10); // expiring in 10 seconds
$scope.$on('countdown-expired', function(event, exp) {
vm.expired[exp.name] = true;
});
}
})();
</script>
<!-- REQUIRED 2/3 - styles for the countdown component -->
<link rel="stylesheet" href="dist/countdown.css">
<!-- REQUIRED 3/3 - the countdown directive -->
<script src="dist/countdown.controller.js"></script>
<script src="dist/countdown.directive.js"></script>
<!-- styles for this demo page -->
<style>
body {
font: 12px Arial;
background: white;
text-align: center;
}
</style>
</head>
<body ng-controller="demoController as vm">
<div class="countdown-con countdown-xs">
<countdown countdown-id="cd1" countdown-title="Days Until Christmas" target-date="vm.xmas"></countdown>
</div>
<hr />
<div class="countdown-con countdown-sm orange">
<countdown countdown-id="cd2" countdown-title="Hours Until Tomorrow" target-date="vm.tomorrow"></countdown>
</div>
<hr />
<div class="countdown-con countdown-md">
<countdown ng-hide="vm.expired.cd3" countdown-id="cd3" countdown-title="Expiring Countdown" target-date="vm.expiring"></countdown>
<h2 ng-show="vm.expired.cd3">Expired Countdown!</h2>
</div>
<hr />
<div class="countdown-con countdown-lg orange">
<countdown countdown-id="cd4" countdown-title="Days Until 2018" target-date="'2018-01-01'"></countdown>
</div>
</body>
</html>