-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path4.1-digest.html
58 lines (48 loc) · 1.06 KB
/
4.1-digest.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
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8"/>
<title>AngularJS Plunker</title>
<link rel="stylesheet" href="style.css"/>
<script src="angular.js"></script>
</head>
<body ng-controller="MainCtrl">
<ul>
<li ng-repeat="item in arr track by $index">
<span>{{$id}}</span>
<ul>
<li ng-repeat="item in arr track by $index">
<span>{{$id}}</span>
<ul>
<li ng-repeat="item in arr track by $index">
<span ng-click="test($id)">{{$id}}</span>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</body>
<style>
.ng-scope {
border: solid 1px #0066cc;
margin: 5px;
}
</style>
<script>
var app = angular.module('plunker', []);
var scopeHash = {};
app.controller('MainCtrl', function ($scope) {
$scope.arr = [1, 2, 3];
$scope.test = function($id) {
var scope = scopeHash[$id];
scope.$digest();
};
setTimeout(function() {
console.log('start');
var scope = scopeHash['004'];
scope.$digest();
}, 3000);
});
</script>
</html>