AngularJS view not updating on model change

后端 未结 4 1673
暗喜
暗喜 2020-12-12 14:31

i\'m trying to figure out how Angular works and am having trouble getting my view to update when the model changes..

HTML

4条回答
  •  忘掉有多难
    2020-12-12 15:02

    Just use $interval

    Here is your code modified. http://plnkr.co/edit/m7psQ5rwx4w1yAwAFdyr?p=preview

    var app = angular.module('test', []);
    
    app.controller('TestCtrl', function ($scope, $interval) {
       $scope.testValue = 0;
    
        $interval(function() {
            $scope.testValue++;
        }, 500);
    });
    

提交回复
热议问题