So I have a search box which has a few parameters that I want to limit my search by. This includes first name and last name in my example.

So I've been trying to implement this like so. This is the code for the drop down list.
<select id="usersearchby" ng-model="searchFilter" ng-change="selectAction()">
<option>Search By ...</option>
<option value="lastName">Last Name</option>
<option value="firstName">First Name</option>
</select>
This is the code for the input search field.
<input type="search" ng-if="searchFilter != 'firstName' && searchFilter != 'lastName'" ng-model="searchText">
<input type="search" ng-if="searchFilter == 'firstName'" ngModel="searchText.first_name">
<input type="search" ng-if="searchFilter == 'lastName'" ngModel="searchText.last_name">
This is the code for the div where the results are shown.
<div class="block_line_item userlist_expanded" ng-repeat="user in users | filter: searchText">
This code doesn't work however, if I just have a single input search box for say first_name (no conditional inputs), it works just fine! What am I doing wrong? Is there a better way of doing this?
A sample of the json data I'm working with:
[{"role":"1","credentials":"","work_phone":"206–298–3059","last_name":"Doe","middle_name":"","suffix":"","title":"Mr.","mobile_phone":"1–877–932–4259","id":1,"fax":"135–678-6357","first_name":"John","email":"[email protected]","username":"user1"}, {"role":"1","credentials":"","work_phone":"206–298–3059","last_name":"Doe","middle_name":"","suffix":"","title":"Mr.","mobile_phone":"1–877–932–4259","id":2,"fax":"135–678–6357","first_name":"Jane","email":"[email protected]","username":"user2"}]
$http.get("/users").success(function(data) { $scope.users=data; });The users data is in json with key value pairs for first_name and last_name among others.