javascript - Push is not working -
after reading data of each loop. data populating successfully. trying push objects in array named test data fails. push not working. below code.
$scope.testdata=[]; data.content.foreach(function(column) { var objects = { ip: "", user: "", date_created:"" }; objects.ip = column.ip; objects.user = column.username; var d = new date(column.created); var = d.toutcstring(); objects.date_created = a; testdata.push(objects); }); $scope.safeapply(); }, function(error){ console.log(error); });
you should assign $scope ,try this
$scope.testdata.push()
Comments
Post a Comment