I have the following markup
<ion-view view-title="Troops">
<div class="bar bar-subheader item-input-inset">
<label class="item-input-wrapper">
<i class="icon ion-ios-search placeholder-icon"></i>
<input type="search" placeholder="Search" ng-model="troop.first">
</label>
<button class="button button-clear button-positive" ng-click="cancelSearch()">
Cancel
</button>
</div>
<ion-content class="has-subheader">
<ion-list>
<ion-item ng-repeat="troop in troops | filter:troop" href="#/app/troops/{{troop.id}}" on-hold="deleteTroop(troop.id)">
{{troop.rank}} {{troop.first}} {{troop.last}}
</ion-item>
</ion-list>
</ion-content>
<div class="bar bar-footer bar-positive">
<button class="button button-clear pull-left icon ion-paper-airplane" ng-click="sendMessageBlast()"></button>
<div class="title">{{numberOfTroops}}</div>
<button class="button button-clear pull-right icon ion-plus" ng-click="addNewTroop()"></button>
</div>
This works but it will only filter by troop.first. I would like to be able to have it also filter by troop.last or troop.ran or a combination of any of them. Can you guys help me out.
The problem that I am having is that if I change the search ng-model to just “troop”, the filter will use the phone and email items of the troop object.
Thanks