“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!!