首页 > Web开发 > 详细

ionic angularJS input 相关指令 以及定时器 的使用

时间:2016-02-26 21:50:04      阅读:164      评论:0      收藏:0      [点我收藏+]
 
技术分享
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
        <script type="text/javascript" src="../angular.min.js"></script>
    </head>
    <body>
      <div ng-app="myApp">

          <div ng-controller="firstController">
              <input type="button" ng-value="text" ng-disabled="isDisabled">
              <input type="text" value="{{text}}" ng-readonly="isDisabled">
              <input type="checkbox" value="{{text}}" ng-checked="isDisabled">
          </div>
      </div>
      <script type="text/javascript">
        var app = angular.module(myApp,[]);
          app.controller(firstController,[$scope,$interval,function($scope,$interval){
              var iNow = 5;
              $scope.text = iNow+;
              $scope.isDisabled = true;

              //setInterval -> $scope.$apply()
              //$timeout   $interval

              var timer = $interval(function(){
                  iNow--;
                  $scope.text = iNow+;

                  if(iNow == 0){
                      $interval.cancel(timer);
                      $scope.text = 可以点击啦;
                      $scope.isDisabled = false;
                  }

              },1000);

          }]);
      </script>
       
    </body>
</html>
View Code

 

ionic angularJS input 相关指令 以及定时器 的使用

原文:http://www.cnblogs.com/nikyxxx/p/5221696.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!