[英]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.