angularjs - 如何显示最后一个索引输入值标签... ng-repeat
问题描述
如何在 ng-repeat 的最后一个索引中显示输入值,但它显示每个行项目...我只想要最后一个索引用户输入付款金额请任何人帮助我,非常感谢
<table class="table display table-hover table-bordered product-overview mb-10" id="support_table">
<thead>
<tr class="bg-info">
<th class="col-md-4">Shirka Name</th>
<th class="col-md-1">Approvals</th>
<th class="col-md-2">CompanyRate</th>
<th class="col-md-1">Mofa Upload Date</th>
<th class="col-md-2">Payment</th>
<th class="col-md-1">Balance</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in VisaPaymentList">
<td>{{item.ShirkaName}}</td>
<td>{{item.approvals}}</td>
<td>{{item.CompanyRate}}</td>
<td>{{item.DateField}}</td>
<td><input ng-change="BalanceMinus()"
ng-model="item.PaymentReceived" autocomplete="off"
id="payment" class="form-control input-height"
placeholder="Payment" type="text">
</td>
<td>{{item.Balance}}</td>
</tr>
</tbody>
</table>
解决方案
将ng-if
指令与项目范围的$last
属性一起使用:ng-repeat
<tr ng-repeat="item in VisaPaymentList">
<td>{{item.ShirkaName}}</td>
<td>{{item.approvals}}</td>
<td>{{item.CompanyRate}}</td>
<td>{{item.DateField}}</td>
<td>
<̶i̶n̶p̶u̶t̶ ̶n̶g̶-̶c̶h̶a̶n̶g̶e̶=̶"̶B̶a̶l̶a̶n̶c̶e̶M̶i̶n̶u̶s̶(̶)̶"̶
<input ng-if="$last" ng-change="BalanceMinus()"
ng-model="item.PaymentReceived" autocomplete="off"
̶i̶d̶=̶"̶p̶a̶y̶m̶e̶n̶t̶"̶ ̶c̶l̶a̶s̶s̶=̶"̶f̶o̶r̶m̶-̶c̶o̶n̶t̶r̶o̶l̶ ̶i̶n̶p̶u̶t̶-̶h̶e̶i̶g̶h̶t̶"̶ ̶
name="payment" class="form-control input-height"
placeholder="Payment" type="text">
</td>
<td>{{item.Balance}}</td>
</tr>
当$last
是true
时,<input>
将添加元素。否则<td>
元素将为空。
有关详细信息,请参阅
推荐阅读
- python - Keras CNN 坐标回归仅给出平均值
- python - 如何使用可以更改的列表在多列上迭代矢量化 if/else 语句?
- docker - Visual Studio 解决方案中的多个 docker-compose .dcproj
- java - android - 'android.database.CursorIndexOutOfBoundsException: 请求索引 0,大小为 0'
- javascript - 带有地图的Javascript箭头函数
- r - 将绘图与高度可变的宽度相结合
- linux - 使用 find 和 tar 复制文件
- pca - 澄清主成分分析
- python - 如何在数据框中取一列的平均值,但从 datetimestamp 列每 5 分钟取一次?
- java - java并发hashmap中clear的默认行为是什么