-
Notifications
You must be signed in to change notification settings - Fork 0
/
ang3.html
49 lines (45 loc) · 1.08 KB
/
ang3.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
<!DOCTYPE html>
<html ng-app="zfmodule">
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="angular.js"></script>
</head>
<body >
<div ng-controller="rootCtrl" ng-init="show=false">
<input type="button" ng-click="clickme()" value="wo1">
<div >
{{num}}
</div>
</div>
<div ng-controller="rootCtrl" ng-init="show=false">
<input type="button" ng-click="clickme()" value="wo2">
<div >
{{num}}
</div>
<hello></hello>
</div>
</body>
<script>
var app = angular.module('zfmodule',[]);
app.controller('rootCtrl',function($http,$scope,$rootScope){
$scope.name = "hello";
$rootScope.num = 1;
$scope.clickme = function(){
$http({
url:"/book",
method:'get'
}).success(function(data){
console.log(data);
})
}
});
app.directive('hello',function(){
return {
restrict:"A",
template:"<span>你好啊</span>",
replace:true
}
})
</script>
</html>