-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzdy.html
41 lines (38 loc) · 863 Bytes
/
zdy.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
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>自定义指令</title>
</head>
<body>
<div ng-controller="test" >
<form>
<input type="button" value="收藏" my-sc />
</form>
</div>
<script type="text/javascript" src="js/jquery203.js" ></script>
<script type="text/javascript" src="js/angular.min.js" ></script>
<script>
var app = angular.module('myApp',[]);
var fal = true;
app.directive('mySc',function(){
return {
restrict:'A',
link:function(){
$('input').on('click',function(){
if(fal = true){
$('input').val('已收藏');
fal = false;
}else{
$('input').val('收藏');
fal = true
}
});
}
}
});
app.controller('test',['$scope',function($scope){
}]);
</script>
</body>
</html>