代码改变世界

13.angular时间

2017-04-13 16:48  笨笨03  阅读(135)  评论(0编辑  收藏  举报
<!DOCTYPE html>
<html ng-app="myApp" ng-controller="myCtrl">
<head lang="en">
<meta charset="UTF-8">
<title>T38-angular时间</title>
<script src="js/angular.js" type="text/javascript"></script>
</head>
<body>

<p>{{theTime}}</p>

</body>

<script type="text/javascript">
var app = angular.module("myApp", []);
app.controller("myCtrl", function ($scope,$interval) {
$scope.theTime = new Date().toLocaleTimeString();
$interval(function () {
$scope.theTime = new Date().toLocaleTimeString();
},1000);


});


</script>
</html>