I have an Array of Objects retrieved from server. The Query works, but when I do the ng-repeat in the html view, it doesn't work, it doesn't show anything. Why?
This is the js 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 companyListDetail Array (response from server):
companyListDetail: Array[2]
0: Object
1: Object
length: 2
This is the 0: Object :
email: "[email protected]"
name: "Compant 2"
In console I have no error, and in html page of browser I have this:
<!-- ngRepeat: company in companyList -->
$scope.companyList = companyListDetail;byconsole.log($scope.companyList)as it is having same array of objects or not.