我在对象上使用嵌套的ng-repeat和过滤器。第一个ng-repeat是对gapHeader对象中的headerId的过滤器。第二个ng-repeat过滤器gapSection,sectionId到相应的headerID。AngularJS - 过滤ng-repeat内对象的原始索引
我有一个编辑页面是在一个单独的模式窗口。其目的是编辑对应于该子对象的headerID & sectionID的内容)这也具有单独的控制。数据通过服务共享。
我的问题我有一个按钮为每个gapSection子对象,它打开编辑页面模式,当我将每个部分内的当前部分的$索引值传递给服务时,我得到的$索引只对应于第二个ng-repeat?例如,如果我点击gapSection(headerId:2,sectionId:2)上的2 ng-repeat内的按钮,我会得到1的$ index。我需要一个2的$ index,它对应于gapSection中的子对象位置。
是否可以传递真正的$ index对应于gapSection的原始未过滤对象中定义的$ index?欣赏对此的任何评论,并感谢你!
对象:
var data ={
gapHeader:[{headerId:1,name:"General Requiremets",isApplicable:true},
{headerId:2,name:"Insurance",isApplicable:false}],
gapSection:[{headerId:1,sectionId:1,requirement:"A facility is required to have company structure",finding:null,cmeasures:null,cprocedures:null,personResp:null,isAction:null},
{headerId:2,sectionId:1,requirement:"Organisation must have public liablity",finding:null,cmeasures:null,cprocedures:null,personResp:null,isAction:null},
{headerId:2,sectionId:2,requirement:"Facility must hold workers compensation insurance",finding:null,cmeasures:null,cprocedures:null,personResp:null,isAction:null}]
};
这看起来类似以下内容: [嵌套NG重复和$指数问题] [1] [1]:http://stackoverflow.com/questions/15256600/passing -2-index-values-nested-ng-repeat – Manube 2015-02-08 00:18:16