简体   繁体   English

如何在ng-table中使用正则表达式进行过滤?

[英]How to filter using regex in ng-table?

我正在使用ng-table,如何使用正则表达式而不是字符串进行搜索?

You can use custom filterComparator in ngTableParams: 您可以在ngTableParams中使用自定义filterComparator:

$scope.tableParams = new this.ngTableParams({}, {
    filterOptions: {
        filterComparator: function(actual, expected) {
            return typeof actual == 'string' && actual.match(new RegExp(expected, 'i'));
        }
    }
  });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM