zoukankan      html  css  js  c++  java
  • angularJs-clock

     1 <!DOCTYPE html>
     2 <html lang="en" ng-app="myClock">
     3 <head>
     4 <meta charset="UTF-8">
     5 <title>angularJs-clock</title>
     6 <script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js"></script> 
     7 </head>
     8 <body>
     9 <div ng-app ng-controller="MyController">
    10 <h1>现在时间是:<span ng-bind="clock"></span></h1>    
    11 </div>
    12 </body>
    13 <script>
    14 angular.module('myClock',[])
    15 .controller('MyController', function($scope,$timeout){
    16 var updateClock = function(){
    17 $scope.clock = new Date();
    18 } 
    19 updateClock();
    20 }
    21 )
    22 </script>
    23 </html>
     1 <!DOCTYPE html>
     2 <html lang="en" ng-app="myClock">
     3 <head>
     4     <meta charset="UTF-8">
     5     <title>angularJs-clock</title>
     6     <script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js"></script> 
     7 </head>
     8 <body>
     9     <div ng-app ng-controller="MyController">
    10         <h1>现在时间是:<span ng-bind="clock.fulldate"></span></h1>        
    11     </div>
    12 </body>
    13 <script>
    14     angular.module('myClock',[])
    15     .controller('MyController', function($scope){
    16         $scope.clock = {};
    17         var updateClock = function(){
    18             $scope.clock.now = new Date();
    19             $scope.clock.fulldate = new Date().getFullYear()+"-"+(new Date().getMonth()+1)+"-"+new Date().getDate()+" "+new Date().getHours()+":"+new Date().getMinutes()+":"+new Date().getSeconds()
    20         }
    21         setInterval(function(){
    22             $scope.$apply(updateClock);
    23         },1000)
    24         updateClock();
    25     }
    26 )
    27 </script>
    28 </html>
    View Code
  • 相关阅读:
    scala之伴生对象的继承
    scala之伴生对象说明
    “Failed to install the following Android SDK packages as some licences have not been accepted” 错误
    PATH 环境变量重复问题解决
    Ubuntu 18.04 配置java环境
    JDBC的基本使用2
    DCL的基本语法(授权)
    ZJNU 1374
    ZJNU 2184
    ZJNU 1334
  • 原文地址:https://www.cnblogs.com/johnhery/p/9787990.html
Copyright © 2011-2022 走看看