<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body ng-app="myApp" ng-controller="mainController">
<p>{{a}}</p>
<script src="angular.min.js"></script>
<script>
angular.module('myApp',[]).controller('mainController',function($scope){
$scope.a = 100;
setTimeout(function(){
$scope.$apply(function(){
$scope.a = 200;
});
},500);
});
</script>
</body>
</html>
网友评论