AngularJS - 具有ng-repeat和过滤器的过滤表

时间:2015-07-17 16:15:31

标签: javascript angularjs

所以我有一个大约有800行的表,每行有两个单元格。我遇到的问题是需要花费很长时间才能过滤掉。我想知道你是否有任何改善过滤时间的建议。

这是我的代码:

<input type="text" class="search" placeholder="Type to search..." ng-model="search">
<tr ng-repeat="item in items|filter:search track by $index" ng-click="clickList($index)" class="tableRow">
    <td class="english" style="width: 50%">
        <p class="term">{{item.english}}</p>
    </td>
    <td class="spanish" style="width: 50%">
        <p class="term">{{item.spanish}}</p>        
    </td>
</tr>

编辑:

我的项目看起来像这样:

var legalObject = [{
    english: 'accord and satisfaction',
    spanish: 'acuerdo transaccional'
        }, {
    english: 'acknowledged the same to be his free act and deed',
    spanish: 'reconoció el mismo como su escritura otorgada libremente'
        }, {
    english: 'adjudication',
    spanish: 'juicio en el tribunal de menores'
        }, {
    english: 'adverse witness',
    spanish: 'testigo desfavorable'
        }, {
    english: 'advice of rights',
    spanish: 'lectura de derechos'
        }];

0 个答案:

没有答案