我尝试在应用过滤器后在范围内获取已处理的集合,以便使用ngRepeat中的别名更新分页,但即使过滤了“#”,也会出现错误。不是关键字。
HTML
<ion-item ng-repeat="item in Items | filter:custname
| filter: applyDateFilter('order_date',globalModels.fromdate, globalModels.toDate) as filtered
| pagination: currentPage * itemsPerPage | limitTo: itemsPerPage" class="my-item item-text-wrap">
对于custname,我为&#34; custname&#34;添加了$ scope.watch。在那里使用filterFilter能够获得过滤后的列表,如下所示:
$scope.filtered = filterFilter($scope.Items, term);
但日期过滤器代码不同,进行日期比较并返回布尔值,因此不确定如何在那里获取过滤列表。
日期过滤器示例:
if (orderDt >= fromDt) {
return true;
}
ERROR:
[INFO:CONSOLE(26794)] "Error: [ngRepeat:badident] alias 'filtered| pagination: currentPage * itemsPerPage | limitTo: itemsPerPage' is invalid --- must be a valid JS identifier which is not a reserved name.
http://errors.angularjs.org/1.5.3/ngRepeat/badident?p0=filtered%7C%20pagination%3A%20currentPage%20*%20itemsPerPage%20%7C%20limitTo%3A%20itemsPerPage
at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:13438:12
at Object.ngRepeatCompile [as compile] (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:42074:15)
at applyDirectivesToNode (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:22224:32)
at compileNodes (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:21626:15)
at compileNodes (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:21638:15)
at compileNodes (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:21638:15)
at compileNodes (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:21638:15)
at compileNodes (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:21638:15)
at compileNodes (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:21638:15)
at compile (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:21525:15)", source: file:///android_asset/www/lib/ionic/js/ionic.bundle.js (26794)