I'm doing a web app.
I have a dynamic table. First, you choose a PRODUCT and then the LOT. 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 <select>
LOT.
So, first I tried to add the field in the LOT column using the following codes:
$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);
}
});
};
and it works (here 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 (here is another example). Why? Maybe the correct way is to add the item in the json and then refresh the LOT, but how can I add the item in the json?