Kalana Tebel
Kalana Tebel

Reputation: 105

How to load data when user types 3 letters in Kendo Dropdown list in Angular?

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

Answers (1)

Prajapati Vikas
Prajapati Vikas

Reputation: 300

you can use kendo drop-down property "minLength" as like given in this kendo example. Kendo drop-down minLength

Upvotes: 0

Related Questions