TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nicker
NA
5
3.2k
filter table with multiple input with "OR" operator
Jun 8 2016 11:28 PM
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>
Reply
Answers (
1
)
What is AngularJS?
put method angularjs