I have an array of objects that I fetched from the server. The query is working fine, but when I try to use the ng-repeat
directive in my HTML view, nothing is being displayed. Why could this be happening?
Here is the JavaScript code:
$scope.companyList = [];
$scope.getCompanyList = function() {
$scope.companyList.length = 0;
CompanyListSrv.getCompanyListDetail(function (companyListDetail) {
if (companyListDetail) {
$scope.companyList = companyListDetail;
}
});
};
$scope.getCompanyList();
HTML code:
<tr ng-repeat="company in companyList">
<td>{{ company.name }}</td>
<td>{{ company.email }}</td>
</tr>
This is the array that was returned from the server:
companyListDetail: Array[2]
0: Object
1: Object
length: 2
This is one of the objects in the array:
email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="aadecfd2deeadecfd2de84c9c5c7">[email protected]</a>"
name: "Company 2"
There are no errors in the console. However, in the browser, the HTML page shows:
<!-- ngRepeat: company in companyList -->