[英]How to implement filter in strict mode in ng-grid?
我正在使用ng-grid填充数据。 我正在使用ng-grid内部过滤器。 但这不是我想要的。
数据是
$scope.myData = [{name: "Moroni", age: 50},
{name: "Tiancum", age: 43},
{name: "Jacob", age: 27},
{name: "Nephi", age: 29},
{name: "Enos", age: 34}];
如果我搜索“ Moroni”,则得到所需的输出。 但是,如果我搜索“ roni” (莫罗尼),我就不会看到莫罗尼的名字。 我的问题是我如何才能对键值进行严格的比较。
我希望过滤器仅在以下情况下才为真
filterText == 'Moroni'
[完全匹配文本,而不是子字符串]
在过滤器的有角度文档中: http : //docs.angularjs.org/api/ng.filter :filter
您可以在comparator
下找到它:
true: A shorthand for function(actual, expected) { return angular.equals(expected, actual)}.
this is essentially strict comparison of expected and actual.
因此,尝试filter:filterText:true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.