想在网页上,显示当前系统时钟。
class="code_img_closed" src="/Upload/Images/2017103118/0015B68B3C38AA5B.gif" alt="" />logs_code_hide('bdbcf696-e286-4048-b877-80acda33980d',event)" src="/Upload/Images/2017103118/2B1B950FA3DF188F.gif" alt="" />
<body ng-app="App2" ng-controller="Ctrl2"> <div ng-bind="ShowTime"> </div> </body>Source Code
angularjs程序:
var app = angular.module('App2', []); app.controller('Ctrl2', function ($scope, $interval, $filter) { $scope.Timer = $interval(function () { var time = $filter('date')(new Date(), 'HH:mm:ss'); $scope.ShowTime = time; },1000); });Source Code
演示: