Как выполнить операцию увеличения и уменьшения количества нескольких строк таблицы в Angular js 1.x, а строки повторяются с помощью ng-repeat
У меня есть код jQuery, и я не знаю, какреализовать его в угловых JS.Первый код - это то, как я реализую его в jQuery, а следующий фрагмент кода - то, как я реализую его в угловых js, но я не могу увеличивать или уменьшать количество.
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous">
</script>
<script>
$(".addqt").click(function() {
var $row = $(this).closest("tr");// Find the row
var $quantity= $row.find(".qun").val();
var new_quantity=parseInt($quantity)+1;
$row.find(".qun").val(new_quantity);
});
$(".subqt").click(function() {
var $row = $(this).closest("tr");// Find the row
var $quantity= $row.find(".qun").val();
var new_quantity=parseInt($quantity)-1;
$row.find(".qun").val(new_quantity);// Find the text box near subtract buuton and assign new value
});
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<table border="box">
<tr>
<th>Part No</th>
<th>Price</th>
<th>Quantity</th>
</tr>
<tr>
<td>ZB80900259</td>
<td>619.74</td>
<td>
<button id="neen" class='btn btn-success addqt'>+</button>
<input readonly type='text' class='qun text-center' value='0' style='width:30px;height:34px;'>
<button id="geen" class='btn btn-danger subqt'>-</button>
</td>
</tr>
<tr>
<td>Z80098330</td>
<td>230.00</td>
<td>
<button id="neen" class='btn btn-success addqt'>+</button>
<input readonly type='text' class='qun text-center' value='0' style='width:30px;height:34px;'>
<button id="geen" class='btn btn-danger subqt'>-</button>
</td>
</tr>
</table>
</html>
Угловой код js
https://plnkr.co/edit/o4CJr5P696NdpP66Qkxh?p=preview
<tr ng-repeat="rec in records">
<td>{{rec.partno}}</td>
<td>{{rec.price}}</td>
<td>
<button id="neen" class='btn btn-success addqt'>+</button>
<input readonly type='text' class='qun text-center' value='0' style='width:30px;height:34px;'>
<button id="geen" class='btn btn-danger subqt'>-</button>
</td>
</tr>