小编shu*_*111的帖子

AngularJS视图未更新模型更改

我正在试图弄清楚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)

http://jsfiddle.net/N2G7z/

有任何想法吗?

javascript angularjs

72
推荐指数
4
解决办法
10万
查看次数

标签 统计

angularjs ×1

javascript ×1