-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo25.html
51 lines (45 loc) · 1.35 KB
/
demo25.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
<!DOCTYPE html>
<html ng-app="myapp">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>demo24</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
var app = angular.module('myapp', []);
app.controller('aaa', function aaa($scope,$interval) {
var isNow = 5 ;
$scope.text = isNow + "秒" ;
$scope.isDis = true ;
var timer = $interval(function(){
isNow--;
$scope.text = isNow + "秒" ;
if(isNow == 0){
$scope.text = "确定";
$scope.isDis = false ;
$interval.cancel(timer); // 清除定时器
}
},1000);
});
</script>
<style>
.active {background: #f00;}
</style>
</head>
<body>
<div ng-controller="aaa">
<!-- ng-disabled 禁用按钮 输入框等 动态的改变按钮的状态 -->
<!-- value 和 ng-value 建议使用 ng-value -->
<input type="button" value="{{text}}" ng-disabled="isDis">
<input type="button" ng-value="text" ng-disabled="isDis">
<!-- ng-readonly 禁用输入框 不能禁用按钮 -->
<input type="text" value="{{text}}" ng-readonly="isDis">
<input type="text" ng-value="text" ng-readonly="isDis">
<!-- ng-checked 选中状态 -->
<input type="checkbox" value="{{text}}" ng-checked="isDis">
</div>
</body>
</html>