當表內表在表內動態重複時ng-if不起作用當我在子表中添加一行時,在錯誤的父索引中使用index.am這樣的,但在輸入提起工作正常,但是當按鈕不起作用NG-如果條件採取錯誤的父索引ng-if使用ng-repeat嵌套表迭代時不起作用
如:
<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重複顯示整個表格 –
請參考我在https://stackoverflow.com/questions/20111636/index-of-object-in-array-while-using-ng-repeat-and-a-過濾器/ 37085767#37085767。它可能對你有所幫助 – Manas
在上面的代碼中,當ng-if condtion被移除時它工作正常,但是我想把那個condion – Maxi