我無法獲取下面提到的表格的單元的數量。我只希望在表中獲取計數body.Please幫助我實現這 - 即時通訊尋求獲得數OF-如何使用量角器獲取數據中單元的數量
<td class="ng-binding ng-scope" ng-if="paymentDetails.responseObject[0].fee_amount > 0">$0.90</td>
請讓我知道如何做到這一點。謝謝!!
<div class="show-for-large-up">
<table>
<thead>
<tr>
<!-- ngIf: paymentDetails.responseObject[0].fee_amount > 0 -->
<th class="ng-binding ng-scope" ng-if="paymentDetails.responseObject[0].fee_amount > 0" ng-bind-html="receiptTemplate.paymentFee" width="300">Payment Fee</th>
<!-- end ngIf: paymentDetails.responseObject[0].fee_amount > 0 -->
</tr>
</thead>
<tbody>
<!-- ngRepeat: lineItem in paymentDetails.responseObject[0].schedules[0].schedule_line_items track by $index -->
<tr class="ng-scope" ng-repeat="lineItem in paymentDetails.responseObject[0].schedules[0].schedule_line_items track by $index">
<td class="ng-binding">$45.00</td>
<!-- ngIf: paymentDetails.responseObject[0].fee_amount > 0 -->
<td class="ng-binding ng-scope" ng-if="paymentDetails.responseObject[0].fee_amount > 0">$0.90</td>
<!-- end ngIf: paymentDetails.responseObject[0].fee_amount > 0 -->
</tr>
<!-- end ngRepeat: lineItem in paymentDetails.responseObject[0].schedules[0].schedule_line_items track by $index -->
<tr class="ng-scope" ng-repeat="lineItem in paymentDetails.responseObject[0].schedules[0].schedule_line_items track by $index">
<td class="ng-binding">Jul 21, 2017</td>
<td class="ng-binding">$0.00</td>
<!-- ngIf: paymentDetails.responseObject[0].fee_amount > 0 -->
<td class="ng-binding ng-scope" ng-if="paymentDetails.responseObject[0].fee_amount > 0">$1.68</td>
<!-- end ngIf: paymentDetails.responseObject[0].fee_amount > 0 -->
</tr>
</tbody>
</table>
</div>
我tried-什麼,但IM得到計數爲3。其實數應在1
var paymentTable = $$('.show-for-large-up tr');
var row = paymentTable.$$('[ng-repeat="lineItem in paymentDetails.responseObject[0].schedules[0].schedule_line_items track by $index"]');
var cell = row.$$('[ng-if="paymentDetails.responseObject[0].fee_amount > 0"]');
var cellCount = cell.filter(function(elm) {
return elm.count();
expect(elm.count()).toBe(1);
});
你是如何訪問'elm.count()'過濾器外側?你沒有得到錯誤? –
抱歉,複製代碼時出現錯字,現在編輯。 – Smitha