【问题标题】:angularjs filter by parent indexangularjs按父索引过滤
【发布时间】:2017-07-11 09:11:27
【问题描述】:

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

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

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

【问题讨论】:

  • ng-repeat="process in processes | filter : { park: $parent.$index }"

标签: javascript angularjs filter


【解决方案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">

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-04
    • 2013-09-19
    相关资源
    最近更新 更多