[追加]ボタンをクリックすると、新しい行が作成されます。私は3行を持っていると私は削除ボタンを使用して2番目の行の値を削除する。anglejsを使用して特定の行の値を削除する方法
[削除]ボタンをクリックすると、行は削除されますが、最後の行インデックスの値はデフォルトで削除されます。
私はフィドルhttp://jsfiddle.net/6Texj/287/
<td >
<input type="text" name="count" class="form-control2" autocomplete="off" id="langlistNumber_{{$index}}">
</td>
<td><input type="text" name="count" class="form-control3" autocomplete="off" id="langlist_{{$index}}"></td>
<td><input type="text" name="count" class="form-control3" autocomplete="off" id="langurllist_{{$index}}">
<a href ng-click="removelanglist(index)" ng-if="displayremovebutton">Remove</a>
</td>
$scope.addlanguagelist = function() {
debugger;
var index = $scope.languagelist.length;
console.log(index);
$scope.isCollapsed = true;
$scope.displayremovebutton = true;
$scope.languagelist.push({
"model.urlListNumber": "",
"model.numbersUrlList": "",
"model.url": "",
"index": $scope.countBlocks
});
$timeout(function() {
$scope.countBlocks++;
}, 200)};
$scope.removelanglist = function(index) {
console.log(index);
$scope.languagelist.splice(index, 1);
};
ng-click="removelanglist($index)"
にあなたの期待どおりに動作します私の提案されたソリューションを使用してみてください、リンクjsfiddleでデモを確認してください。 –