填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

ComponentFactory

Base class for a factory that can create a component dynamically. Instantiate a factory for a given type of component with resolveComponentFactory(). Use the resulting ComponentFactory.create() method to create a component of that type.

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

参见

属性

属性说明
abstract selector: string只读

The component's HTML selector.

abstract componentType: Type<any>只读

The type of component the factory will create.

abstract ngContentSelectors: string[]只读

Selector for allelements in the component.

abstract inputs: { propName: string; templateName: string; }[]只读

The inputs of the component.

abstract outputs: { propName: string; templateName: string; }[]只读

The outputs of the component.

方法

Creates a new component.

abstract create(injector: Injector, projectableNodes?: any[][], rootSelectorOrNode?: any, ngModule?: NgModuleRef<any>): ComponentRef<C>
      
      abstract create(injector: Injector, projectableNodes?: any[][], rootSelectorOrNode?: any, ngModule?: NgModuleRef<any>): ComponentRef<C>
    
参数
injector Injector
projectableNodes any[][]

可选. 默认值是 undefined.

rootSelectorOrNode any

可选. 默认值是 undefined.

ngModule NgModuleRef

可选. 默认值是 undefined.

返回值

ComponentRef<C>