-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path5.1-setter.html
73 lines (59 loc) · 1.32 KB
/
5.1-setter.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>AngularJS Plunker</title>
<script src="angular.js"></script>
</head>
<body ng-app="MyApp">
<div ng-controller="MyCtrl">
<label>Primitive</label>
<input type="text" ng-model="name">
<label>Object</label>
<input type="text" ng-model="user.name">
<div class="nested" ng-controller="MyNestedCtrl">
<div>
<label>Primitive</label>
<input type="text" ng-model="name">
</div>
<div>
<label>Primitive with explicit $parent reference</label>
<input type="text" ng-model="$parent.name">
</div>
<div>
<label>Object</label>
<input type="text" ng-model="user.name">
</div>
<div class="nested" ng-controller="SubCtrl">
<div>
<label>Object</label>
<input type="text" ng-model="user.name">
</div>
</div>
</div>
</div>
</body>
<style>
.nested {
border: 1px solid red;
margin-left: 2em;
padding: 1em;
}
.ng-scope {
border: 2px solid blue;
}
</style>
<script>
var app = angular.module("MyApp", []);
app.controller("MyCtrl", function($scope) {
$scope.name = "Peter";
$scope.user = {
name: "Parker"
};
});
app.controller("MyNestedCtrl", function($scope) {
});
app.controller("SubCtrl", function($scope) {
});
</script>
</html>