Pretty old question but I will still answer. I happened to catch this question as I am also looking for the same solution.
Not maybe the best practice or there might be much better solution but I just created a map for my array so I could create a new field for full_name
.
See code below if this could help you out.
template:
<ng-select
[(ngModel)]="_selected_user"
[items]="_all_users"
placeholder="Select User"
bindLabel="full_name"
bindValue="id"
>
<ng-template ng-option-tmp let-item="item" let-search="searchTerm">
<div><span></span><span [ngOptionHighlight]="search">{{item.full_name }}</span></div>
<small>User ID: <b>{{item.user_id}}</b> </small>
</ng-template>
</ng-select>
component:
users.map(
(user: any) => {
user.full_name = user.last_name + ', ' + member.first_name + ' ' + member.middle_name
return member;
}
)
This one will enable searching via first_name
or last_name
or middle_name
or altogether in one search key.