title: Angular JS copy Object to another into a for loop
body: <p>Trying to copy a part of a json object into another json object (thats a filter), into a for loop, under a conditional statement, it doesn't work.</p>
  
  <p>This work but a plain to write an array:</p>
  
  <pre><code>$scope.candidats=[];
  for (i=0;i&lt;omegaCandidats.length;i++){
      if (omegaCandidats[i].dateRdv==date){ 
          $scope.candidats.push(
              {
               "id"       :omegaCandidats[i].id,
               "prenom"   :omegaCandidats[i].prenom,
               "nom"      :omegaCandidats[i].nom,
               "heure"    :omegaCandidats[i].heure,
               "dateRdv"  :omegaCandidats[i].date
              }
          )
      };
  };
  </code></pre>
  
  <p>This doesn't work, and that's what i want to do. Its logical and should work: </p>
  
  <pre><code>$scope.candidats=[];
  for (i=0;i&lt;omegaCandidats.length;i++){
      if (omegaCandidats[i].dateRdv==date){ 
          $scope.candidats[i] = omegaCandidats[i];
      };
  };
  </code></pre>
  
  <p>This one work but only get one value of the for loop its useless:</p>
  
  <pre><code>$scope.candidats=[];
  for (i=0;i&lt;omegaCandidats.length;i++){
      if (omegaCandidats[i].dateRdv==date){ 
          $scope.candidats[0] = omegaCandidats[i];
      };
  };
  </code></pre>