AngularJS 的$timeout服务示例代码
废话不多说了,直接给大家贴代码了,具体代码如下所示:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript" src="../js/angular.js" ></script> <script> var app=angular.module("myApp",[]); app.controller("myCtrl",function($scope,$timeout){ //获取当前系统的时间对象 $scope.name="战三"; //设置定时器,每一秒调获得以下系统时间,复制给$scope.time $timeout(function(){ $scope.name="李四"; },3000); }); </script> </head> <body ng-app="myApp" ng-controller="myCtrl"> <p>{{name}}</p> </body> </html>
总结
相关推荐
QiaoranC 2020-09-25
颤抖吧腿子 2020-09-04
liduote 2020-06-16
阿斌Elements 2020-06-11
xxuncle 2020-06-05
ChinaGuanq 2020-06-05
wanghongsha 2020-03-26
csm0 2020-03-05
shyoushine 2020-02-25
electronvolt 2020-02-12
jsonwoo 2020-01-20
ZadarrienChina 2020-01-07
wwwxuewen 2020-01-04
dynsxyc 2020-01-03
liangjielaoshi 2019-12-27
bowean 2019-12-27
wwwxuewen 2019-12-25
liwusen 2019-12-16
颤抖吧腿子 2019-12-16