angularjs按父索引

时间:2017-07-11 09:11:27

标签: javascript angularjs filter

我需要根据表索引将行放入表中,如:

<table ng-repeat="park in parks track by $index">
 <tr ng-repeat="process in processes | process.park=$parent.$index">

进程是一个对象,我需要将process.park与表的索引进行比较。

1 个答案:

答案 0 :(得分:1)

使用$parent为变量分配索引。

使用ng-if验证索引

<table ng-repeat="park in parks track by $index" ng-init="parentIndex = $index">
 <tr ng-repeat="process in processes" ng-if="process.park=parentIndex">