【发布时间】:2017-11-18 19:44:30
【问题描述】:
当表格内的表格在那个时候动态重复时 ng-if 不起作用。当我在子表格中添加一行时采取错误的父索引。我像这样使用但在输入字段中工作正常但按钮不起作用当 ng-if 条件采用错误的父索引时
例如:
<div id="parentdivId" ng-repeat="parent in listOfParentTables">
<table >
<thead class="evlhead ingpopuphead">
<tr>
<th >A</th>
<th >B</th>
<th >C</th>
</tr>
</thead>
<tbody >
<tr ng-repeat="child in parent.childMaster" ng-if="child.status!=2">
<td >
<select id="a10" ng-model="child.a10">
<option ng-repeat="list in listMaster" value={{list.ID}}>{{list.NAME}}</option>
</select>
</td>
<td ><div class="addrembtn" ><input class="btnadd" type="button" value="+" id="addbutton10" ng-click="addNewChildRow($parent.$index,$index)"><input class="btnrem" type="button" value="-" id="deletebutton10" ng-click="removechildRow($parent.$index,$index)"></div></td>
</tr>
</tbody>
</table>
<div style="float:left;">
<button class="parentbtn" style="margin:37px 0px 0px 17px !important;width: 75px;" value="AddTable" id="basebutton" ng-click="addNewParenttable($index)">+ Gasto</button>
</div>
<div style="float:left;">
<button class="parentbtn" style="margin: 12px 0px 0px 17px !important;width: 75px;" value="AddTable" id="basebutton" ng-click="removeParenttable($index)">- Eliminar</button>
</div>
</div>
【问题讨论】:
-
用 ng repeat 显示完整的表格
-
请参阅我在stackoverflow.com/questions/20111636/… 上的回答。它可能会帮助你
-
在上面的代码中,当 ng-if 条件被移除时它工作正常,但我想放那个条件
标签: angularjs