1 <div ng-controller="firstController"> 2 3 {{date}} 4 5 </div> 6 7 8 <script> 9 var firstController = function($scope){ 10 $scope.date = new Date(); 11 12 setInterval(function(){ 13 $scope.$apply(function(){ 14 $scope.date = new Date() 15 //会去触发脏检查 用于自定义 16 }) 17 },1000)
//controller最后会自动触发脏检查 18 }