使用 ng-repeat 在视图中显示数据时出错 AngularJS

Errors using ng-repeat to display data in view AngularJS

我正在尝试使用 ng-repeat 在视图中显示数组中的一些数据,但它不起作用。

这是我的 html 的样子:

<div>
        <p>loop here</p>
        <ul>
            <li ng-repeat="item in transferTest">{{item.Marks}}</li>
            <li>{{item}}</li>
            <li>{{item.Marks}}</li>
        </ul>
    </div>

我的控制器是这样的:

 $scope.resultsArray.push({"Module_Code": $scope.moduleCode, "Marks" :$scope.marks,"Recommendation" :$scope.moduleRecommendation})                                       
  $rootScope.transferTest = $scope.resultsArray;

基本上我的数据是这样组织的:

[
{"Module_Code": "IT", "Marks": "70", "Recommendation": "test"}
{"Module_Code": "ACC", "Marks": "30","Recommendation": "testintuber"}

It seems that I am unable to access the $rootScope.transferTest from the view.

您的 JSON 格式不正确,

应该是,

[
{"Module_Code": "IT", "Marks": "70", "Recommendation": "test"},
{"Module_Code": "ACC", "Marks": "30","Recommendation": "testintuber"}]

DEMO

您的数据格式不正确: [ {"Module_Code"= "IT", "Marks": "70", "Recommendation": "test"} {"Module_Code**:= "ACC", "Marks:** "30","Recommendation:= "testintuber