<!DOCTYPE html> <html lang="en"> <head> <Meta charset="UTF-8"> <title>倒计时</title> <script type="text/javascript" src='../angularJs/angular-1.2.13/angular.min.js'></script> </head> <body> <div ng-app="myApp"> <div ng-controller="firstController"> <input type="button" ng-value ="text" ng-disabled="isdisable"/> <input type="text" value="{{text}}" ng-readonly="isdisable" /> <input type="checkBox" value="{{text}}" ng-checked="isdisable" /> </div> </div> </body> <script type="text/javascript"> var app = angular.module("myApp",[]); app.controller('firstController',['$scope','$interval',function ($scope,$interval) { $scope.n = 10; $scope.text = $scope.n + "秒"; $scope.isdisable = true; var time = $interval(function () { $scope.n--; $scope.text = $scope.n + "秒"; if ($scope.n == 0) { $interval.cancel(time); $scope.isdisable = false; $scope.text = "可以点击"; } },1000); }]);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。