Reputation: 152
I'm trying to create a component with ng-select inside. Also I want to add a search field in dropdown:
<ng-select
#mySelect
[items]=[cars]
[placeholder]="placeholder"
>
<ng-template ng-header-tmp>
<span>My label</span>
</ng-template>
<ng-template> Need search filed here</ng-template>
<ng-template ng-option-temp>
Some options
</ng-template>
</ng-select>
The search field display as option, but on first place. Is there some way to do that?
Upvotes: 1
Views: 392
Reputation: 174
simply you can add new input into the header template eg:
<ng-template ng-header-tmp>
<input type="text" [(ngModel)]="searchBtn" (ngModelChange)="changeSearchFn($event)"/>
</ng-template>
and filter the cars items when model change
see the full example here Full Example
Upvotes: 1