我正在试图弄清楚Angular是如何工作的,并且在模型更改时我无法更新视图.
HTML
<div ng-app="test">
<p ng-controller="TestCtrl">
{{testValue}}
</p>
</div>
Run Code Online (Sandbox Code Playgroud)
JS
var app = angular.module('test', []);
app.controller('TestCtrl', function ($scope) {
$scope.testValue = 0;
setInterval(function() {
console.log($scope.testValue++);
}, 500);
});
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?