Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Post
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Reply
filter table with multiple input with "OR" operator
Nicker
8 years ago
321
Reply
Hi,
I have 2 input field, and I want to filter the table against the 2 input fields using OR instead of And.
However I'm unable to do it with the code below, the table return all field regardless what I type in the input, anyone can help me with it?
<script type="text/javascript">
function checking($scope) {
$scope.check = function(tableField,input) {
if (input.type == "or"){
if (tableField.name.indexOf(input.name) > -1 || input.name == null || tableField.created_by.indexOf(input.createdby) > -1 || input.createdby == null ){
return true
}
else{
return false
}
}
}
}
</script>
<table ng-table="table">
<tbody>
<tr ng-repeat="car in cars" ng-controller="checking" ng-show="check(car,externalFilters)">
<td data-title="'Name'">
{{car.name}}
</td>
<td data-title="'Created by'">
{{ car.created_by || 'unknown' }}
</td>
</tr>
</tbody>
</table>
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
What is AngularJS?
put method angularjs