title: AngularJS forEach .push undefined
body: <p>I am new to AngularJS (started this week) and I want to pull a couple of items out of the $http.post returned data and create a new object $scope.tests.latLngAll with a subset of the data. </p>
  
  <p>If I do the below with .push in the forEach I get an error that $scope.tests.latLngAll is undefined even though I am trying to define it in line 4. </p>
  
  <pre><code>$scope.tester = function( ){    
  
  $scope.tests = {};
  $scope.tests.latLngAll = {};
  
  $http.post( '/src/shops.php' , $scope.postdata )
      .success( function(data) {
  
      $scope.tests = data;
  
      angular.forEach( $scope.tests, function( value, key ){ 
          $scope.tests.latLngAll.push( { key :  value } ); 
          }); 
      })          
  }
  </code></pre>
  
  <p>If I replace the .push with '=' the last item in the array is the only value assigned to $scope.tests.latLngAll which makes sense.</p>
  
  <p>$scope.tests.latLngAll = ( { key :  value } ); </p>
  
  <p>I assume this means the data is there and accessible through forEach 'value' but I am not doing the push right. </p>
  
  <p>Thanks for the help.</p>