时间:2021-03-11 10:07:46 | 栏目:AngularJS | 点击:次
废话不多说了,直接给大家贴代码了,具体代码如下所示:
<!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>
总结