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

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -