问题
I see during load that the scope element $scope.docDetails
has the necessary data.
In the view when I use the ng-repeat to print info, I see that it is not displayed in browser.
<body ng-controller="documentUploadController" nv-file-drop="" uploader="uploader" filters="queueLimit, customFilter">
<div class="container">
<div ng-repeat="row in documentUploadController.docDetails">
<div class="col-sm-2">{{row.DocumentTypeName}}</div>
<div class="col-sm-3 elementwrap"><a href="#" ng-click="documentUploadController.downloadDocument(row)">{{row.FileName}}</a> </div>
..
</div>
</div>
WHen i view the HTML ,i see the ng-repeat code being commented out
Where am I going wrong?
回答1:
Currently, your ng-repeat variable is $scope.docDetails
Since $scope already equals the controller, remove the controller reference in ng-repeat
like <div ng-repeat="row in docDetails">
<body ng-controller="documentUploadController" nv-file-drop="" uploader="uploader" filters="queueLimit, customFilter">
<div class="container">
<div ng-repeat="row in docDetails">
<div class="col-sm-2">{{row.DocumentTypeName}}</div>
<div class="col-sm-3 elementwrap"><a href="#" ng-click="documentUploadController.downloadDocument(row)">{{row.FileName}}</a> </div>
..
</div>
</div>
来源:https://stackoverflow.com/questions/31426872/ng-repeat-code-getting-commented-out-when-viewed-from-browser