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.
Asked
Active
Viewed 3,183 times
0
-
Hi, it's seems working fine as you described as output result. – Jitendra G2 Jan 09 '19 at 06:03
-
yes, i want to show dropdown only when users type something, right now its showing on focus – Nikhil Savaliya Jan 09 '19 at 06:16
-
You meant to say, when you click on multi-select drop-down, it should not show the item list? Item list only displayed when you start a typing something. Am I correct? – Jitendra G2 Jan 09 '19 at 06:28
-
yes,you got it. – Nikhil Savaliya Jan 09 '19 at 06:41
-
something like autocomplete? – KiraAG Jan 09 '19 at 07:21
-
its better if you using multi select you should have checkbox to select all and deselectAll – harkesh kumar Jan 09 '19 at 07:32
1 Answers
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