このダウンは自分のHTMLコードからは小さいです。コードは動的な行を追加/削除します。Angularjs:ダイナミックテーブルの行を削除するにはどうすればいいですか?配列から削除しないでください
<tr class="clone" ng-repeat="dataItem in dataInvoce.Invoicetoitem.items track by $index">
<td class="number">{{$index + 1}}</td>
<td><input type="text" id="codeto{{$index}}" size="11" ng-model="dataItem.item.code" ng-keyup="getCodeItem($index)" class="tagsItem">
<td><input type="hidden" id="hidden{{$index + 1}}" ng-model="dataItem.item.itemID" >
<input type="text" ng-model="dataItem.item.itemName" id="item{{$index}}" class="tagsItem" ng-keyup="getItemInvoice($index)" name="itemName" required></td>
<td><input type="text" ng-model="dataItem.item.solid" size="11" id="solid{{$index + 1}}" ng-disabled="invoice.itemName.$error.required" required></td>
<td><input type="text" ng-model="dataItem.quantity" id="quantity{{$index+1}}" ng-keyup="totals($index+1)" size="10" ng-disabled="invoice.itemName.$error.required" required></td>
<td><input type="text" ng-model="dataItem.price" ng-keyup="totals($index+1)" value="111" id="price{{$index + 1}}" ng-disabled="invoice.itemName.$error.required" required></td>
<td><input type="text" ng-model="dataItem.discount" id="discount{{$index+1}}" ng-keyup="totals($index+1)" size="11" ng-disabled="invoice.itemName.$error.required" required></td>
<td>{{dataItem.quantity * dataItem.price * (1 - dataItem.discount/100) | number:2}}</td>
<td><a class="btn btn-default" ng-click="removeItem ($index)">-</a></td>
</tr>
これは私のすべての項目の配列から「removeItem」ボタンremoven行をクリックしますが、とremoven要素row.When削除力学のための私のfuncitonです。 dynamicla行を削除したいが、すべての項目で配列から要素を削除しないでください。
$scope.removeItem = function (index)
{
console.log($scope.dataInvoce.Invoicetoitem.items);
$scope.dataInvoce.Invoicetoitem.items.splice (index, 1);
console.log($scope.dataInvoce.Invoicetoitem.items);
$scope.total ($scope.dataInvoce.Invoicetoitem.items);
};
を渡す設定。 –
あなたは単にcss display = noneを行に追加するか、@SSHがng-showまたはng-hideをどのようにしたかを入力することができます。 –
Ng-show削除する行をどのように知っていますか? –