码迷,mamicode.com
首页 > Web开发 > 详细

AngularJs练习Demo4

时间:2016-06-22 00:09:47      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:

 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>

 

AngularJs练习Demo4

标签:

原文地址:http://www.cnblogs.com/sumg/p/5605342.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!