<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript" src="angular-1.3.0.js"></script> <script> var app = angular.module("myApp", []); app.controller("myCtrl", function ($scope, $interval, $timeout) { //每一秒执行一次,一直执行 $interval(function () { //时间 $scope.nowtime = new Date().toLocaleDateString() + " " + new Date().toLocaleTimeString(); }, 1000); //5秒后执行一次,只执行一次 $timeout(function () { $scope.mytext = "Java B C"; }, 5000); }); </script> </head> <body ng-app="myApp"> <div ng-controller="myCtrl"> <div>时间:{{ nowtime }}</div> <div>等待5秒显示的文字:{{ mytext }}</div> </div> </body> </html>
html5_AngularJs计时器
最新推荐文章于 2021-05-31 13:02:45 发布