|
<div class="col-lg-8 control-section multiline">
<div class="content-wrapper">
<ejs-textbox
id="name"
placeholder="Enter your address"
required
></ejs-textbox>
<ejs-dropdownlist
id="menuId"
#sample
[dataSource]="sportsData"
[fields]="fields"
[placeholder]="waterMark"
[popupHeight]="height"
></ejs-dropdownlist>
</div>
</div>
public json: object = { menuId: "1", name: "Football" };
ngAfterViewInit(e: any): void {
for (let item in this.json) {
document.getElementById(item).ej2_instances[0].value = this.json[item];
}
}
|
Hi, I am currently having the same problem. I need to set values of syncfusion components (Dropdown, Checkbox, ...), but outside the range, where I could use ViewChild. So, I tried to do this with the document.getElementByID() method, but I am getting the error:
Property 'ej2_instances' does not exist on type 'HTMLElement'.
Is there a way to avoid this? Do I have to cast the HTMLElement to something else
|
ngAfterViewInit(e: any): void {
for (let item in this.json) {
(document.getElementById(item) as any).ej2_instances[0].value = this.json[
item
];
}
} |