im working with the angularjs framework. Here is my Code first:
var app = angular.module('app',['ngRoute','ngAnimate']); app.controller('maincontroller',function($scope,$http) { $scope.planes = []; $scope.createPlanes = function() { $http.post('api/create_plane.php',{ }).success(function(data,status,headers,config) { console.log(data); for(var result in data) { $scope.planes = [ {"planeLMID": data[result]['planeLMID']} ]; } console.log($scope.planes); }); }; $scope.createPlanes(); });
And this is the return of the console.log(data);
Object {1: Object, 2: Object, 3: Object, 4: Object, 5: Object, 6: Object, 7: Object, 8: Object, 9: Object, 14: Object, 15: Object, 16: Object, 17: Object, 18: Object, 20: Object, 21: Object, 23: Object, 24: Object, 25: Object, 26: Object, 27: Object, 29: Object, 31: Object, 32: Object, 33: Object, 34: Object, 35: Object, 36: Object, 37: Object, 38: Object}
And a sample of how a object in it look like
planeAFID: "89-3412" planeCPISPI: "" planeLMID: "8215"
so i want to do a $scope.planes array with a for loop. But after the first object it doenst fill anymore. How can i push the other objects into the array?
Thanks
$scope.planes.push( {"planeLMID": data[result]['planeLMID']})