-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCompileLink2.html
49 lines (41 loc) · 1.08 KB
/
CompileLink2.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>
<head>
<meta charset="utf-8">
<script src="//cdn.bootcss.com/angular.js/1.5.0/angular.js"></script>
<title></title>
</head>
<body ng-app="myapp">
<div ng-controller="first">
<loader hwoToLoad="loading()">滑动加载</loader>
</div>
<div ng-controller="second">
<loader hwoToLoad="loading2()">滑动加载</loader>
</div>
<script type="text/javascript">
var app = angular.module('myapp',[]);
app.controller('first',['$scope',function($scope){
$scope.loading=function(){
console.log('加载中....')
}
}])
app.controller('second',['$scope',function($scope){
$scope.loading2=function(){
console.log('加载中....222')
}
}])
// 注意 hwotoload 这边要写成小写
app.directive('loader' , function(){
return {
restrict: "AE",
link: function(scope,element,attrs){
element.bind('mouseenter', function(event) {
console.log(attrs.hwotoload)
scope.$apply( attrs.hwotoload )
})
}
}
} )
</script>
</body>
</html>