Im trying to build something like this:
<input name="ItemsList[0].Date" />
<input name="ItemsList[1].Date" />
<input name="ItemsList[2].Date" />
<input name="ItemsList[3].Date" />
The inputs are generated by AngularJS using ng-repeat, and they're submitting their data correctly. But they also can be removed using Angular. And there's the problem.
When an element in the middle of the list is removed, i get something like this on HTML:
<input name="ItemsList[0].Date" />
<input name="ItemsList[2].Date" />
<input name="ItemsList[3].Date" />
The form is submitting only "ItemsList[0]" because the missing "ItemsList[1]" element and its reference to the next element (Linked List).
Is there a way to solve this without having to change all elements names when an element is removed?
Ps¹.: Im using a directive to create the "Date" bound with JQueryUI datepicker. So when the name and ID of the input is changed manually, sometimes the datepicker missfunction.
Ps².: The inputs are being built like this:
<div ng-repeat="item in items">
<input name="ItemsList[{{item.}}].Date" />
</div>
Aucun commentaire:
Enregistrer un commentaire