AngularJS之定时器(timeout)

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

1、问题背景

     AngularJS某一时间段后,出现另一种情况,这里需要用到定时器timeout


2、实现源码

<!DOCTYPE html><html> <head>  <meta charset="UTF-8">  <title>AngularJS之定时器(timeout)</title>  <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>  <script>   var app = angular.module("timeApp",[]);   app.controller("timeController",function($scope,$timeout){    $scope.information = 111;    $timeout(function(){     $scope.information = 222;    },2000);   });  </script> </head> <body>  <div ng-app="timeApp" ng-controller="timeController">   <label>{{information}}</label>  </div> </body></html>

3、实现结果

(1)初始化时

         111

(2)2S之后

         222

           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

猜你喜欢

转载自blog.csdn.net/jrrfgj/article/details/84077015