Angularjs:搜索开始时搜索过滤器无效! (感叹号)
如果我的数据类似名称=' Anand!'
客户端过滤器应该与searchWord ='!'
一起使用如果有人有相同的解决方案,请提供相同的信息。
提前致谢!!
我的代码:
{…}
payload: {…}
_document: Object { key: {…}, version: {…}, hasLocalMutations: true, … }
_firestore: Object { _queue: {…}, INTERNAL: {…}, _config: {…}, … }
_fromCache: true
_key: Object { path: {…} }
__proto__: Object { data: data(), get: get(), id: Getter, … }
type: "value"
__proto__: Object { … }
答案 0 :(得分:1)
在上面的示例中,您仅在first_name上提供过滤器,并且该函数对所有人都是通用的,因此我们可以在任何地方使用它
这也可以实现,您所要做的就是获取Create a data flow task with a source of Employee Table.
Add lookup to flow with HR Table and join lookup to data flow on UserID & Date
Then Add Probation a new column to Flow.
(You might want to set ignore lookup failure)
You can then write the results to a file or table.
中所有字段的值,然后匹配object
,如下所示: -
您需要做的就是写一个自己的searchText
custom filter
angular.module('app', []).controller('ctrl', function($scope) {
$scope.customers = [{
"id": 1,
"first_name": "Anand!",
"last_name": "GK",
"gender": "Male"
}, {
"id": 2,
"first_name": "ABC !",
"last_name": "XYZ",
"gender": "Female"
}];
}).filter('searchFilter', function() { /* this the Custom Filter, you can code it to include other fields in search too */
return function(input, searchText) {
if (!searchText)
return input;
var matchedRecord = [];
var matchFound = false;
for (var i = 0; i < input.length; i++){
for (var key in input[i]) {
if(input[i][key] != undefined && input[i][key].toString().toLowerCase().indexOf(searchText.toLowerCase()) != -1) {
matchFound = true;
}
}
if(matchFound)
matchedRecord.push(input[i]);
matchFound = false;
}
return matchedRecord;
}
});