Angularjs 如何在检查ng repeat循环js中每行的条件后显示和隐藏表列?
检查一个条件后,我在使用Angularjs 如何在检查ng repeat循环js中每行的条件后显示和隐藏表列?,angularjs,angularjs-ng-repeat,show-hide,Angularjs,Angularjs Ng Repeat,Show Hide,检查一个条件后,我在使用ng repeat的表中显示/隐藏列时遇到问题。这是我的密码 <div class="row"> <div class="col-md-12 col-no-pad-mob"> <div class="content-box-with-label without-label with-data-view"> <table c
ng repeat
的表中显示/隐藏列时遇到问题。这是我的密码
<div class="row">
<div class="col-md-12 col-no-pad-mob">
<div class="content-box-with-label without-label with-data-view">
<table class="table table-striped table-bordered table-hover table-responsive table-data-view">
<tr>
<th> </th>
<th>Fee Type</th>
<th>Fee</th>
<th class="th_DSCR_Cal">Capitalize</th>
<th class="th_DSCR_Cal">Amortize</th>
<th>Amortized Interest</th>
<th>Recurring Fee</th>
<th class="boo-tbl-tr-config">Setting</th>
</tr>
<tr ng-repeat="amo in item.trialCalculation.listTrialAmortization | filter:{active: true}">
<td class="boo-tbl-tr-config">
<md-checkbox ng-model="amo.isApply" ng-change="GenerateFee_ChangeEvent(item.trialCalculation.listTrialAmortization,amo, item)" aria-label="Checkbox 1" ng-value="amo.isApply" ng-disabled="statusMatched == true"></md-checkbox>
</td>
<td>
{{amo.feeType}}
</td>
<td>
<input class="form-control" step=".01" ng-model="amo.fee" ng-readonly="statusMatched == true || amo.feeType ==='Stamp Duty'|| amo.feeType ==='Document Fee'|| amo.feeType ==='Introducer Fee'|| amo.feeType ==='Insurance Fee'" ng-disabled="amo.isApply === false"
ng-pattern="/[0-9.,]+/" format="number" type="text" ng-change="ResetAmortization_ChangeEvent(item.trialCalculation.listTrialAmortization,amo, item)">
</td>
<td class="boo-tbl-tr-config">
<md-checkbox ng-model="amo.capitalize" ng-change="ValidateCapitalize_ChangeEvent(item.trialCalculation.listTrialAmortization,amo)" aria-label="Checkbox 1" ng-disabled="statusMatched == true || amo.isApply == false || amo.isCapitalizeEnable == false || amo.amortize == true"></md-checkbox>
</td>
<td class="boo-tbl-tr-config">
<md-checkbox ng-model="amo.amortize" ng-change="GenerateAmortization_ChangeEvent(item.trialCalculation.listTrialAmortization,amo, item)" aria-label="Checkbox 1" ng-value="amo.amortize" ng-disabled="statusMatched == true || amo.isApply == false || amo.isAmortizeEnable == false || amo.capitalize == true"></md-checkbox>
</td>
<td>
<input class="form-control" step=".01" ng-model="amo.amortizedInterest" ng-disabled
ng-pattern="/[0-9.,]+/" format="number" type="text" ng-readonly="true">
</td>
<td>
<input class="form-control" step=".01" ng-model="amo.recurringFee" ng-disabled
ng-pattern="/[0-9.,]+/" format="number" type="text" ng-readonly="true">
</td>
<td ng-hide="statusMatched == true" class="boo-tbl-tr-config">
<a href="#" ng-show="cprinit.editable==true && (amo.isCapitalizeEnable==false || amo.amortize==true)"
ng-click="GenerateAmortization_ChangeEvent(item.trialCalculation.listTrialAmortization,amo, item)" ng-disabled="amo.isApply === false || amo.amortize === false"><i class="fa fa-refresh" aria-hidden="true"></i></a>
</td>
</tr>
<tr ng-hide="statusMatched == true" class="add_new_expen">
<td colspan="8">
<md-button class="md-fab md-mini md-primary inline-input" data-toggle="modal" data-target="#addincomemodal_{{$index}}">
<md-icon md-svg-src="~/Content/images/add-plus-button.svg"></md-icon>
</md-button>
<label class="label-addnewexpen" data-toggle="modal" data-target="#addincomemodal_{{$index}}">Add New Fee Type</label>
</td>
</tr>
</table>
</div>
</div>
</div>
费用类型
费用
资本化
分期偿还
摊余利息
经常性费用
背景
{{amo.feeType}
添加新的费用类型
只有当所有数据行都应该检查一个条件并且至少有一行通过了该条件时,我才需要显示设置列。如果任何数据行无法通过条件,则不应显示“设置”列。使用控制器中的功能来实现此目的。循环检查所有行以检查条件,在满足条件时设置
$scope.shColumn=true
在你的HTML中
<th ng-if="shColumn">Settings</th>
设置