美文网首页
Android之父_实现服务动态时钟(AngularJs)

Android之父_实现服务动态时钟(AngularJs)

作者: _帅的掉渣 | 来源:发表于2017-09-21 10:57 被阅读0次
    <script>
                var app = angular.module("myApp",[]);
                app.controller("myCtrl",function($scope,$interval){
                    //获取当前系统的时间对象
                    $scope.time = new Date().toLocaleTimeString();
                    //设置定时器,每一秒调获得以下系统时间,复制给$scope.time
                    $interval(function(){
                        $scope.time = new Date().toLocaleTimeString();
                    },1000,5);
                });
            </script>
        </head>
        <body ng-app="myApp" ng-controller="myCtrl">
            <p>当前时间为:{{time}}</p>
        </body>
    
    ``  

    相关文章

      网友评论

          本文标题:Android之父_实现服务动态时钟(AngularJs)

          本文链接:https://www.haomeiwen.com/subject/rudzsxtx.html