1
我想创建一个自定义指令,将放置在DropDownList组件。在指令的构造函数中,我想获得主机DropDownList组件的引用。Kendo UI为角2访问组件从指令
这里是我的代码:
import { Directive, ElementRef } from '@angular/core';
import { DropDownListComponent } from '@progress/kendo-angular-dropdowns';
@Directive({
\t selector: '[trackDDLChanges]'
})
export class TrackDDLChangesDirective {
\t ddl: DropDownListComponent;
\t constructor(elem: ElementRef) {
\t \t this.ddl = elem.nativeElement; <-- how to get the reference of the component?
\t \t
\t }
}
我找不到文档中的任何东西。 ElementRef给了我html元素,但我找不到一种方法将其转换为相应的组件。
在以前版本的剑道,我们可以这样做:
$(elem).data('kendoDropDownList')
去的小部件的引用。
这个版本有类似的东西吗?
谢谢。
辉煌。谢谢@George K – dpdragnev