The code related to table generation is not working in the below function
function populateDataTable(repo_contributor,repo_langauges){
$scope.rowCollection = [
{firstName: 'Laurent', lastName: 'Renard', birthDate: new Date('1987-05-21'), balance: 102, email: '[email protected]'},
{firstName: 'Blandine', lastName: 'Faivre', birthDate: new Date('1987-04-25'), balance: -2323.22, email: '[email protected]'},
{firstName: 'Francoise', lastName: 'Frere', birthDate: new Date('1955-08-27'), balance: 42343, email: '[email protected]'}
];
for (var key in repo_contributor){
console.log(repo_contributor[key]);
var repo_table_data = {};
repo_table_data['repo_name'] = key;
repo_table_data['contributors'] = repo_contributor[key].toString();
repo_table_data['languages'] = repo_langauges[key].toString();
console.log(repo_table_data);
$scope.repo_info_list.push(repo_table_data);
}
console.log("here now");
console.log($scope.repo_info_list.length);
}
the populateDataTable is being populated by the below code
setTimeout(populateDataTable,4000,$scope.repo_contributor,$scope.repo_languages);
$scope.rowCollection
is being set but not being displayed on table( table is empty).
However if $scope.rowCollection
is placed outside the populateDataTable
, the table is populated with correct values.
Your help is greatly appreciated.
$timeout
function for this instead ofsetTimeout
.so inject it to controller. – Hadi J