ComponentFactory
可用来动态创建组件的工厂的基类。resolveComponentFactory()
实例化给定类型的组件的工厂。使用生成的 ComponentFactory.create()
方法创建该类型的组件。
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 | 只读 组件的 HTML 选择器。 The component's HTML selector. |
abstract componentType: Type<any> | 只读 工厂将创建的组件的类型。 The type of component the factory will create. |
abstract ngContentSelectors: string[] | 只读 组件中所有 Selector for all |
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. | ||||||||||||
参数
返回值 |