Angularjs ng对一个父列表对象和多个子列表对象重复
编辑问题: 我的问题是:Angularjs ng对一个父列表对象和多个子列表对象重复,angularjs,angularjs-directive,angular-ui-router,angularjs-ng-repeat,Angularjs,Angularjs Directive,Angular Ui Router,Angularjs Ng Repeat,编辑问题: 我的问题是: 在循环第二个列表后,我尝试添加内部行(单击+),但它也在第二个表中添加外部行(请参考第一个图像以查看屏幕截图) 请查看下面的代码 请参考下图了解jsp页面: <div ng-repeat = "constospopuptablemain in costosPopupTableMainList"> <div class="col-md-11 col-sm-10 col-xs-10 table-responsive ingpopup
在循环第二个列表后,我尝试添加内部行(单击+),但它也在第二个表中添加外部行(请参考第一个图像以查看屏幕截图) 请查看下面的代码 请参考下图了解jsp页面:
<div ng-repeat = "constospopuptablemain in costosPopupTableMainList">
<div class="col-md-11 col-sm-10 col-xs-10 table-responsive ingpopuptableres" style="float:left;">
<table class="table table-fixed table-condensed table-striped table-bordered table-hover no-margin tablemarg">
<thead class="evlhead ingpopuphead">
<tr>
<th class="evltablethcontreg">Detalle Producto</th>
<th class="evltablethcontreg">Contidad</th>
<th class="evltablethcontreg">Unidad de medida</th>
<th class="evltablethcontreg">Precio Compra(PC)</th>
<th class="evltablethcontreg">Precio Venta(PV)</th>
<th class="evltablethcontreg">CVTAS</th>
<th class="evltablethcontreg">Add/Remove</th>
</tr>
</thead>
<tbody class="evltbodypopup">
<tr ng-repeat = "costosmaintablerow in constospopuptablemain.costosMainTableRowList">
<td ><input type="text" class="no-marginconreg" ng-model="costosmaintablerow.detalledeproducto"> </td>
<td ><input type="text" class="no-marginconreg" ng-model="costosmaintablerow.contidad"></td>
<td ><input type="text" class="no-marginconreg" ng-model="costosmaintablerow.unidaddemedia"> </td>
<td ><input type="text" class="no-marginconreg" ng-model="costosmaintablerow.pc"></td>
<td ><input type="text" class="no-marginconreg" ng-model="costosmaintablerow.pv"> </td>
<td ><input type="text" class="no-marginconreg" ng-model="costosmaintablerow.cvtas"> </td>
<td ><div class="addrembtn"><input class="btnadd" type="button" value="+" ng-click = "addCostoRow(constospopuptablemain.row,$index)">
<input class="btnrem" type="button" value="-" ng-click = "removeCostoRow(constospopuptablemain.row,$index)"></div></td>
</tr>
</tbody>
</table>
</div>
<div style="float:left;">
<button style="background-color: #FAF0E6;width: 68px;margin:55px 0px 0px 4px;font-size: 13px;">+ Casto</button>
</div>
<div class="Promediodivcosto">
<label>Promedio</label> <input type="text" class="tottextfldingpop">
</div>
<div class="CostoTotalpopdiv">
<label>Costo Total</label> <input type="text" class="tottextfldingpop">
</div>
</div>
添加内部行(单击+)时,子列表应重复一次
[请参阅下面的JSP代码链接][3]
比如说,
<div ng-repeat = "listObj1 in listObjParent">
<div ng-repeat ="listObj2 in listObj1.listObjchild">
<input type="text" ng-model = "listObj2"/> <button ng-click="addChilRow()">+</button>
+
对于上述代码,如果父对象长度为2,子对象长度为1。
所以父对象将重复2次,子对象将在每个父对象中可用
问题是,
如果我试图在第一个父对象的子对象中添加一个额外的行(动态输入类型元素)。它还添加了第二个父对象。但不应该这样。 这意味着子对象的每个父对象都应该具有不同的作用域 我希望你能理解我的问题
谢谢。您还没有确定具体的问题或疑问。循环第二个列表后花几分钟阅读我试图添加内部行(单击+),但它也在第二个表中添加外部行(请参考第一张图片查看屏幕截图)为什么要删除html…特别是在我花时间正确格式化所有代码以使其可读之后?现在,所有代码的格式都不正确。当我在第一个表中添加内部行时,不应该在第二个表中添加内部行。你可以在图片中看到对不起。。。我再补充一次
$scope.addCostoRow = function(f,e){
$scope.costosPopupTableMainList[f].costosMainTableRowList.push($scope.getCostosInternalRowList());
}
<div ng-repeat = "listObj1 in listObjParent">
<div ng-repeat ="listObj2 in listObj1.listObjchild">
<input type="text" ng-model = "listObj2"/> <button ng-click="addChilRow()">+</button>