I'm trying to do a search field filter using angular filter for specific fields and which should be an OR condition
This is demo implementation http://jsfiddle.net/tomalex0/ck19wvdx/2/.
I'm trying to search only on Name and Gender but not Location.
Whatever combination i tried it works more like AND condition. Is there an inbuilt way to do OR condition in filter?
<div ng-app="myApp" ng-controller="myController">
<input type="text" ng-model="search">
<ul>
<li ng-repeat="user in users | filter: search">{{user.Name}} | {{user.Location}}
</li>
</ul>
</div>
var data = [
{
Name: "John Smith",
Gender: "M",
Location: "Wales"
},
{
Name: "Sally Smith",
Gender: "F",
Location: "USA"
},
{
Name: "Curtis Timson",
Gender: "M",
Location: "England"
},
{
Name: "Sam Wallace",
Gender: "M",
Location: "England"
},
{
Name: "Caroline James",
Gender: "F",
Location: "Scotland"
}
];
var myApp = angular.module("myApp", []);
myApp.controller("myController", function($scope){
$scope.users = data;
});