Reputation: 105
I have a kendo dropdown and there when user types 3 letters in searchbox, I want to load the data to the dropdown by an API call.
I have tried this way. But it's not getting properly. Can someone give me the proper solution for this?
.ts
public nameList: any[] = [];
modelChange(searchTerm: any){
if(searchTerm !== ""){
this.getnameList(searchTerm);
}
}
getNameList(searchTerm:any){
this.compsService.getNames(searchTerm).subscribe((res) => {
res.data.forEach((element:any) => {
this.nameList = element.name;
});
});
}
.html
<kendo-dropdownlist [data]="nameList " [filterable]="true" textField="companyName"
valueField="partyRoleId" formControlName="name" [valuePrimitive]="true" (ngModelChange)="modelChange($event)">
</kendo-dropdownlist>
Upvotes: 0
Views: 369
Reputation: 300
you can use kendo drop-down property "minLength" as like given in this kendo example. Kendo drop-down minLength
Upvotes: 0