Looking to enhance my user array filtering process with two input boxes.
Here's how the array is structured:
$scope.users = [{ id: 1, fname: 'Sophia', lname: 'Smith', email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="21524e51494840614c4...">[email protected]</a>' }...
The input boxes I'm using are nameSearch and emailSearch. The goal is to search for fname and lname properties with nameSearch, while simultaneously applying emailSearch to the email property.
When using a simple filter like | filter: nameSearch, it searches the entire array object. I specifically want it to only search using fname, lname, and email.
After reading the documentation, I attempted something like this:
<li ng-repeat="user in users | filter:{fname: nameSearch, lname: nameSearch, email: emailSearch}">{{user.fname + ' ' + user.lname}}</li>
However, it doesn't seem to work as expected.
Do I need to create a custom filter for this functionality?