ng-repeat list in AngularJS isn't updated when an ajax call changing its value

前端 未结 1 410
独厮守ぢ
独厮守ぢ 2021-01-13 03:05

I\'m totally confused. Why doesn\'t my ng-repeat refresh when there\'s an ajax call changing its value? I\'ve seen many Q&As here, but none of them talked about ajax cal

相关标签:
1条回答
  • 2021-01-13 03:46

    I've tested your code and as tymeJV said ,there is no problem with your implementation, i would suggest checking the console window for some possible errors.

    Example:

    function EntryCtrl ($scope, $http) {
        $scope.rootEntry = [];
        $http.get('https://api.github.com/users/mralexgray/repos').success(function(root) {
            $scope.rootEntry = root;
            console.log($scope.rootEntry);
        });
    }   
    

    Live example : http://plnkr.co/edit/Grlgfob6tjE63JizWdCD?p=preview

    0 讨论(0)
提交回复
热议问题