-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
130 lines (119 loc) · 3.38 KB
/
index.html
File metadata and controls
130 lines (119 loc) · 3.38 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>AngularTS</title>
<link rel="shortcut icon" type="image/png" href="images/favicon.ico" />
<script type="module" src="/src/index.js"></script>
<script>
document.addEventListener("DOMContentLoaded", () => {
class Todo {
constructor(task) {
this.task = task;
this.done = false;
}
}
class TodoController {
static $scopename = "test";
constructor() {
this.greeting = "Todos";
this.model = {
name: "John",
lastName: "Doe",
};
this.tasks = [
new Todo("Learn AngularTS"),
new Todo("Build an AngularTS app"),
];
}
get() {
return this.counter;
}
increase() {
this.counter++;
}
/**
* @param {String} task
* @return {void}
*/
add(task) {
this.tasks.push(new Todo(task));
}
/**
* Delete all finished tasks
* @return {void}
*/
archive() {
let newTasks = this.tasks.filter((task) => !task.done);
this.tasks = newTasks;
}
}
class Demo {
constructor($eventBus, $scope) {
$eventBus.subscribe("demo", (val) => {
$scope["$ctrl"].mailBox = val;
});
}
}
window.angular
.module("todo", [])
.controller("TodoCtrl", TodoController)
.controller("DemoCtrl", Demo);
});
</script>
<style>
.fade {
background-color: red;
}
/* The starting CSS styles for the enter animation */
.fade.ng-enter {
transition: 0.5s linear all;
background-color: unset;
opacity: 0;
}
/* The finishing CSS styles for the enter animation */
.fade.ng-enter.ng-enter-active {
opacity: 1;
background-color: red;
}
/* The starting CSS styles for the leave animation */
.fade.ng-leave {
transition: 0.5s linear all;
opacity: 1;
}
/* The finishing CSS styles for the leave animation */
.fade.ng-leave.ng-leave-active {
opacity: 0;
background-color: unset;
}
</style>
</head>
<body ng-app="todo">
<div id="$ctrl" ng-controller="TodoCtrl as $ctrl">
<h3>{{ $ctrl.greeting }}</h3>
<button ng-click="$ctrl.archive()">Archive</button>
<button
onclick="angular.getScope(this.parentElement).$ctrl.greeting = 'woot'"
>
test
</button>
<ul>
<li ng-repeat="todo in $ctrl.tasks">
{{ todo.task }} {{ todo.done }}
<input type="checkbox" ng-click="todo.done = !todo.done" />
</li>
</ul>
<form ng-submit="$ctrl.add(newTodo)">
<input type="text" ng-model="newTodo" ng-required="true" />
<button type="submit">Add</button>
</form>
<button ng-get="/mock/div" target="#p" trigger="click" animate="true">
Get
</button>
<div id="p"></div>
<div ng-if="bool" class="fade" animate="true">Fade me in out</div>
<button ng-click="bool=true">Fade In!</button>
<button ng-click="bool=false">Fade Out!</button>
</div>
</body>
</html>