@ -49,7 +49,7 @@ export abstract class ComponentRef<C> {
|
||||
abstract get changeDetectorRef(): ChangeDetectorRef;
|
||||
|
||||
/**
|
||||
* The component type.
|
||||
* The type of this component (as created by a `ComponentFactory` class).
|
||||
*/
|
||||
abstract get componentType(): Type<any>;
|
||||
|
||||
@ -68,6 +68,12 @@ export abstract class ComponentRef<C> {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @see [Dynamic Components](guide/dynamic-component-loader)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export abstract class ComponentFactory<C> {
|
||||
@ -76,7 +82,7 @@ export abstract class ComponentFactory<C> {
|
||||
*/
|
||||
abstract get selector(): string;
|
||||
/**
|
||||
* The component's type
|
||||
* The type of component the factory will create.
|
||||
*/
|
||||
abstract get componentType(): Type<any>;
|
||||
/**
|
||||
|
@ -34,10 +34,20 @@ class _NullComponentFactoryResolver implements ComponentFactoryResolver {
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple registry that maps `Components` to generated `ComponentFactory` classes
|
||||
* that can be used to create instances of components.
|
||||
* Use to obtain the factory for a given component type,
|
||||
* then use the factory's `create()` method to create a component of that type.
|
||||
*
|
||||
* @see [Dynamic Components](guide/dynamic-component-loader)
|
||||
* @publicApi
|
||||
*/
|
||||
export abstract class ComponentFactoryResolver {
|
||||
static NULL: ComponentFactoryResolver = new _NullComponentFactoryResolver();
|
||||
/**
|
||||
* Retrieves the factory object that creates a component of the given type.
|
||||
* @param component The component type.
|
||||
*/
|
||||
abstract resolveComponentFactory<T>(component: Type<T>): ComponentFactory<T>;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user