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

Hey! I'm Anil Singh. I author this blog. I'm Active Blogger, Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...
My Blogs - http://www.code-sample.com and http://www.code-sample.xyz
My Books - Google Amazon and Flipkart Book Store!

You Might Also Like
Post a Comment
www.code-sample.com/. Powered by Blogger.
ASK Questions
SQL Server NodeJs TypeScript JavaScript Angular SQL Server My Book