您的位置:首页 > Web前端 > AngularJS

ComponentFactory取得DOM节点

2017-08-16 13:58 302 查看
取得DOM节点:

ComponentFactoryResolver.resolveComponentFactory.create.location.nativeElement

class ComponentFactoryResolver {
static NULL: ComponentFactoryResolver
resolveComponentFactory<T>(component: Type<T>):ComponentFactory<T>
}


class ComponentFactory<C> {
get selector(): string
get componentType(): Type<any>
get ngContentSelectors(): string[]
get inputs(): {propName: string, templateName: string}[]
get outputs(): {propName: string, templateName: string}[]
create(injector: Injector, projectableNodes?: any[][], rootSelectorOrNode?: string|any, ngModule?: NgModuleRef<any>): ComponentRef<C>
}


class ComponentRef<C> {
get location(): ElementRef
get injector(): Injector
get instance(): C
get hostView(): ViewRef
get changeDetectorRef(): ChangeDetectorRef
get componentType(): Type<any>
destroy(): void
onDestroy(callback: Function): void
}


class ElementRef {
nativeElement: any
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  angularjs2