title: Add item json in ANGULAR with pop-up
body: <p>I'm doing a web app. </p>
  
  <p>I have a dynamic <strong>table</strong>. First, you choose a <strong>PRODUCT</strong> and then the <strong>LOT</strong>. The list of item in the select are taken by json. Now the problem is that I want to add the possibility to create new item to add in the <code>&lt;select&gt;</code> <strong>LOT</strong>. </p>
  
  <p>So, first I tried to add the field in the <strong>LOT</strong> column using the following codes:</p>
  
  <pre><code>  $scope.addLot = function(id,val,lotId) { 
      // console.log(id);
      var inWhichProduct = id;
      var newArray = { "value": val, "id": lotId };
     //console.log($scope.items)
      angular.forEach($scope.items,function(v,i){
        if($scope.items[i].id == id )
        {
          $scope.items[i].lots.push(newArray);
          console.log($scope.items[i].lots);
        }
      });
    };
  </code></pre>
  
  <p>and it works (<a href="http://plnkr.co/edit/W8eche8eIEUuDBsRpLse?p=preview" rel="nofollow">here</a> is an example). But what I want to do is move those fields in a modal window. I tried this, but it doesn't work (<a href="http://plnkr.co/edit/d592JsS6VznPmzcEyDJm?p=preview" rel="nofollow">here</a> is another example). Why? Maybe the correct way is to add the item in the json and then refresh the <strong>LOT</strong>, but how can I add the item in the json?</p>