23 Best Kendo UI Angular 2 DropDownList Actions [How To]

Set Default Value DropDownList Using Kendo Angular 2 [How To]

“How to define a default Item as a primitive value”? and “How to define a default Item as an object value”?

The “Kendo UI Angular 2 DropDownList” is a form component and used binds the data list and chooses a single predefined value as per you from a dropdown list.

The DropDownList default Item property type must be match to the data type. In other word, if the DropDownList data property contains a list of objects, the default Item will need to be defined as an object with the same as text-field and value-field.

Stayed Informed – Live demo Plunker                                          

Example as,

@Component({
  selector: 'my-app',
  template: `
    <kendo-dropdownlist
        [defaultItem]="'Chose item...'"
        [data]="listItems"
        [valuePrimitive]="true"
    >
    </kendo-dropdownlist>
  `
})
class AppComponent {
    public listItems: Array<string> = ["10001-Item 1", "10002-Item 2", "10003-Item 3","10001-Item 4"];
}

References,


I hope you are enjoying with this post! Please share with you friends. Thank you!!
ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog - https://www.code-sample.com/
My Books - Book 1 and Book 2

www.code-sample.com/. Powered by Blogger.
^