如何获取嵌套的ng-repeat项的计数

时间:2015-09-02 23:48:00

标签: angularjs indexing filter count ng-repeat

如果嵌入的ng-repeat块在过滤后没有返回任何值,我怎么能隐藏它? " [如果过滤集中没有项目隐藏]"

           <div ng-repeat="thisCategory in Categories">
                <div class="panel panel-default" ng-hide="filterResult[$index].length == 0">
                    <div class="panel-body" [if no items in filtered set hide]>

                        <div>
                            </h1>{{thisCategory.Title}}</h1>
                        </div>

                        <table class="table table-condensed table-hover">  
                            <tr ng-repeat="app in (filterResult = (apps | filter:search ))">
                                <td>
                                    {{app.Title}}
                                </td>
                            </tr>
                        </table>

                    </div>
                </div>
            </div>

1 个答案:

答案 0 :(得分:0)

喜欢的东西;

<table class="table table-condensed table-hover" 
    ng-show="(filterResult[$index] = (apps | filter:search )).length">  
    <tr ng-repeat="app in (filterResult[$index] = (apps | filter:search ))">
        <td>
            {{app.Title}}
        </td>
    </tr>
</table>