-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
42 lines (40 loc) · 1.15 KB
/
index.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
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>AngularJS Scope and Digest Course Practice</title>
<script src="angular.min.js"></script>
<script src="app.js"></script>
<style>
body { font-family: "Consolas"; font-size: 150%; }
input { font-size: 100%; width: 80%; }
</style>
</head>
<body>
<!-- Main-Controller -->
<div ng-controller="mainCtrl as X">
<div>
<p>Main-F: {{ X.force }}</p>
<input ng-model="X.force" type="number">
</div>
<!-- Sub-Controller -->
<div ng-controller="subCtrl as X">
<p> Main-F from Sub:
<span style="color: orange;">{{ X.mainX.force }}</span>
</p>
<p> Sub-F:
<span style="color: red;">{{ X.force }}</span>
</p>
<input ng-model="X.force" type="number" style="color: red;">
</div>
<!-- End of Sub-Controller -->
</div>
<!-- End of Main-Controller -->
<hr>
<div ng-controller="ctrl as c" ng-init="ok=false;">
<p>♫ {{ c.msg }}</p>
<input ng-if="!ok" ng-model="c.msg" type="text">
<button ng-click="c.obj.random()">Write something random</button>
</div>
</body>
</html>