title: Add item to array Angular
body: <p>I have a table with these fields: <code>product</code>, <code>lot</code>, <code>input1</code>, <code>input2</code>. You can clone a line, and you can add a new line.</p>
  
  <p>What I want to do is that for each row you can add a new Lot created by a "number" and by "id" that user write in the input field under the Select <code>lot</code>. And I <em>wanted</em> that the script add the new Lot in the json data and the <code>lot</code> 's option list.</p>
  
  <p>This is the function for <strong>add</strong> that I tried to do:</p>
  
  <pre><code>$scope.addLot = function() {
      var inWhichProduct = row.selectedProduct;
      var newArray = {
          "number": row.newLot.value,
          "id": row.newLot.id
      };
  
      for (var i = 0; i &lt; $scope.items.length; i++) {
          if ($scope.items[i].selectedProduct === inWhichProduct) {
              $scope.items[i].selectedLot.push(newArray);
          }
      }
  };
  </code></pre>
  
  <p>-->> <a href="http://plnkr.co/edit/y9XDz9oF0vI7Dw08i4vH?p=preview" rel="nofollow"><strong>THIS</strong></a>  &lt;&lt;--   is the full code.</p>
  
  <p>Can you help me? </p>