Hello,
I am trying to create a custom directive that will be placed in a DropDownList component. In the constructor of the directive I would like to get a reference of the host DropDownList component.
Here is my code:
import { Directive, ElementRef } from
'@angular/core'
;
import { DropDownListComponent } from
'@progress/kendo-angular-dropdowns'
;
@Directive({
selector:
'[trackDDLChanges]'
})
export class TrackDDLChangesDirective {
ddl: DropDownListComponent;
constructor(elem: ElementRef) {
this
.ddl = elem.nativeElement; <-- how to get the reference of the component?
}
}
I am using it as:
<
kendo-dropdownlist
[data]="statuses"
[(value)]="value"
[valuePrimitive]="true"
[textField]="'name'"
[valueField]="'id'"
(valueChange)="statusChanged()"
[trackInputChanges]="'some data'" >
</
kendo-dropdownlist
>
I could not find anything in the documentation. ElementRef gives me the html element, but I cannot find a way to convert it into the corresponding component.
In the previous version of kendo we could do:
$(elem).kendo(
'kendoDropDownList'
)
to get a reference to the widget.
Is there something similar available in this version?
Thank you.