AngularJs练习Demo4

 1 @{
 2     Layout = null;
 3 }
 4 
 5 <!DOCTYPE html>
 6 
 7 <html>
 8 <head>
 9     <meta name="viewport" content="width=device-width" />
10     <title>Input</title>
11     <script type="text/javascript" src="~/Scripts/angular.js"></script>
12 </head>
13 <body>
14     <div ng-app="myApp">
15         <div ng-controller="firstController">
16             <input type="button" ng-value="text" ng-disabled="isDisabled" />
17             <input type="text" value="{{text}}" ng-readonly="isDisabled" />
18             <input type="checkbox" value="{{text}}" ng-checked="isDisabled" />
19         </div>
20     </div>
21     <script type="text/javascript">
22         var app = angular.module("myApp", []);
23         app.controller("firstController", function ($scope,$interval) {
24           //  $scope.text = "phoneGap中文网";
25             $scope.isDisabled = true;
26             $scope.n = 5;
27             $scope.text = $scope.n + '秒';
28           var time=$interval(function () {
29               $scope.n--;
30               $scope.text = $scope.n + '秒';
31               if ($scope.n == 0)
32               {
33                   $interval.cancel(time);
34                   $scope.text = "可以点击了";
35                   $scope.isDisabled = false;
36               }
37             },1000)
38         });
39     </script>
40 </body>
41 </html>

 

posted @ 2016-06-21 23:00  编程猴子  阅读(216)  评论(0编辑  收藏  举报