find below appcomponent.html code: <kendo-dropdownlist [defaultItem]="defaultYear" [data]="budgetYears" [valueField]="budgetYears.value"> </kendo-dropdownlist> and in appcomponent.ts file: public budgetYears: Array<{ value: number }> = [ { value: 2019 }, { value: 2020 }, { value: 2021 }, { value: 2022 }, { value: 2023 }, { value: 2024 }, ]; as mentioned above I have provided the mentioned codes but I am not getting the binded values. Instead of that I am getting [object Object]. Why it is so and where I am doing mistake. Please provide me a solution for this. Thanks
Hi Girija,
Thank you for the provided code snippet.
In order to bind the DropDownList to complex object data, the textField, and valueField options should be set to a field from the bound collection e.g:
@Component({
selector: 'my-app',
template: `
<div class="example-wrapper">
<p>T-shirt size:</p>
<kendo-dropdownlist
[data]="listItems"
[textField]="'value'"
[valueField]="'value'"
>
</kendo-dropdownlist>
</div>
`
})
export class AppComponent {
public listItems: Array<{ value: number }> = [
{ value: 1 },
{ value: 2 },
{ value: 3 }
];
}
For more details check the following article:
Regards,
Martin
Progress Telerik