File tree Expand file tree Collapse file tree 1 file changed +35
-7
lines changed Expand file tree Collapse file tree 1 file changed +35
-7
lines changed Original file line number Diff line number Diff line change 1
1
<!DOCTYPE html>
2
2
< html >
3
- < head >
4
- < meta charset ="utf-8 " />
5
- < title > </ title >
6
- </ head >
7
- < body >
8
-
9
- </ body >
3
+ < head >
4
+ < meta charset ="utf-8 " />
5
+ < title > </ title >
6
+ </ head >
7
+ < body ng-app >
8
+ < div ng-controller ="HelloController ">
9
+ < p > {{greeting.text}}, Word</ p >
10
+ < div > {{test.text}}</ div >
11
+ </ div >
12
+ < hr />
13
+ < div ng-controller ="c2 ">
14
+ < form action ="">
15
+ < input type ="text " ng-change ="computeNeed() " ng-model ="nums.num " />
16
+ result: {{needed}}
17
+ </ form >
18
+ </ div >
19
+
20
+ < script type ="text/javascript " src ="js/angular.min.js " > </ script >
21
+ < script type ="text/javascript ">
22
+ function HelloController ( $scope ) {
23
+ // ajax
24
+ $scope . greeting = { text : "Hello 1303A" } ;
25
+ $scope . test = { text : "Hello test..." } ;
26
+
27
+ }
28
+
29
+ function c2 ( $scope ) {
30
+ $scope . nums = { num :0 } ;
31
+ var computeNeed = function ( ) {
32
+ $scope . needed = $scope . nums . num * 10 + ', haha...' ;
33
+ }
34
+ $scope . $watch ( "nums.num" , computeNeed ) ;
35
+ }
36
+ </ script >
37
+ </ body >
10
38
</ html >
You can’t perform that action at this time.
0 commit comments