I have created a table and a search box. I'm trying to filter the table rows based on the value that user enters in the search box. I'm using angular 4 framework.
When I set the filter conditions individually it works but doesn't works when combined.
Below filter works correctly:
return requests.filter(function(request){
return request.requestedBy.indexOf(value)> -1;
});
But this doesn't works:
return requests.filter(function(request){
return request.requestedBy.indexOf(value) + request.client.toLowerCase().indexOf(value)> -1;
})
Used
OR
conditional operator
return requests.filter(function(request){
return request.requestedBy.toLowerCase().indexOf(value.toLowerCase()) > -1 || request.client.toLowerCase().indexOf(value.toLowerCase()) > -1
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.