<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
//需要导入angular.js库文件
<script type="text/javascript" src="../../angular-1.5.5/angular-1.5.5/angular.js"></script>
<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>
</html>