0

I am using, ng-select I am having one multi-select dropdown everything working proper but i want some change, i want to show dropdown when user start types something and show only filtered data on user's typed content in text box.

Nikhil Savaliya
  • 2,138
  • 4
  • 24
  • 45

1 Answers1

1

I hope below logic can helpful,

.HTML

<ng-select #elem [items]="cities2"
               bindLabel="name"
               bindValue="id"
               [multiple]="true"
               placeholder="Select cities"
               [(ngModel)]="selectedCityIds"
               (open)="onOpen(elem)">

.TS

onOpen(elem){
 if(elem.filterInput.nativeElement.value == ""){
   elem.close();
 }
}

If you want to hide drop-down toggle ( V ), you need to add style in parent component/file.

Index.html

<style>
    .ng-select .ng-arrow-wrapper {
        display: none !important;
    }
</style>
Jitendra G2
  • 1,196
  • 7
  • 14