mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
docs: deprecate ComponentFactory and ComponentFactoryResolver symbols (#44749)
DEPRECATED: The `ComponentFactory` and `ComponentFactoryResolver` classes are deprecated. Since Ivy, there is no need to resolve Component factories. Please use other APIs where you Component classes can be used directly (without resolving their factories). PR Close #44749
This commit is contained in:
committed by
Dylan Hunn
parent
2b01e17505
commit
9f12e7fea4
@@ -49,6 +49,8 @@ v13 -> v16
|
||||
| `@angular/core` | [`Compiler`](#core) | <!--v13--> v16 |
|
||||
| `@angular/core` | [`CompilerFactory`](#core) | <!--v13--> v16 |
|
||||
| `@angular/core` | [`NgModuleFactory`](#core) | <!--v13--> v16 |
|
||||
| `@angular/core` | [`ComponentFactory`](#core) | <!--v13--> v16 |
|
||||
| `@angular/core` | [`ComponentFactoryResolver`](#core) | <!--v13--> v16 |
|
||||
| `@angular/platform-browser-dynamic` | [`JitCompilerFactory`](#platform-browser-dynamic) | <!--v13--> v16 |
|
||||
| `@angular/forms` | [`ngModel` with reactive forms](#ngmodel-reactive) | <!--v6--> v11 |
|
||||
| `@angular/upgrade` | [`@angular/upgrade`](#upgrade) | <!--v8--> v11 |
|
||||
@@ -124,6 +126,8 @@ This section contains a complete list all of the currently-deprecated APIs, with
|
||||
| [`CompilerFactory`](api/core/CompilerFactory) | none | v13 | Ivy JIT mode doesn't require accessing this symbol. See [JIT API changes due to ViewEngine deprecation](#jit-api-changes) for additional context. |
|
||||
| [`NgModuleFactory`](api/core/NgModuleFactory) | Use non-factory based framework APIs like [PlatformRef.bootstrapModule](api/core/PlatformRef#bootstrapModule) and [createNgModuleRef](api/core/createNgModuleRef) | v13 | Ivy JIT mode doesn't require accessing this symbol. See [JIT API changes due to ViewEngine deprecation](#jit-api-changes) for additional context. |
|
||||
| [Factory-based signature of `ViewContainerRef.createComponent`](api/core/ViewContainerRef#createComponent) | [Type-based signature of `ViewContainerRef.createComponent`](api/core/ViewContainerRef#createComponent) | v13 | Angular no longer requires component factories to dynamically create components. Use different signature of the `createComponent` method, which allows passing Component class directly. |
|
||||
| [`ComponentFactory`](api/core/ComponentFactory) | Use non-factory based framework APIs. | v13 | Since Ivy, Component factories are not required. Angular provides other APIs where Component classes can be used directly.|
|
||||
| [`ComponentFactoryResolver`](api/core/ComponentFactoryResolver) | Use non-factory based framework APIs. | v13 | Since Ivy, Component factories are not required, thus there is no need to resolve them.|
|
||||
|
||||
{@a testing}
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ export interface ComponentDecorator {
|
||||
new (obj: Component): Component;
|
||||
}
|
||||
|
||||
// @public
|
||||
// @public @deprecated
|
||||
export abstract class ComponentFactory<C> {
|
||||
abstract get componentType(): Type<any>;
|
||||
abstract create(injector: Injector, projectableNodes?: any[][], rootSelectorOrNode?: string | any, ngModule?: NgModuleRef<any>): ComponentRef<C>;
|
||||
@@ -210,7 +210,7 @@ export abstract class ComponentFactory<C> {
|
||||
abstract get selector(): string;
|
||||
}
|
||||
|
||||
// @public
|
||||
// @public @deprecated
|
||||
export abstract class ComponentFactoryResolver {
|
||||
// (undocumented)
|
||||
static NULL: ComponentFactoryResolver;
|
||||
@@ -839,6 +839,7 @@ export abstract class NgModuleFactory<T> {
|
||||
|
||||
// @public
|
||||
export abstract class NgModuleRef<T> {
|
||||
// @deprecated
|
||||
abstract get componentFactoryResolver(): ComponentFactoryResolver;
|
||||
abstract destroy(): void;
|
||||
abstract get injector(): Injector;
|
||||
|
||||
@@ -75,6 +75,9 @@ export abstract class ComponentRef<C> {
|
||||
* @see [Dynamic Components](guide/dynamic-component-loader)
|
||||
*
|
||||
* @publicApi
|
||||
*
|
||||
* @deprecated Angular no longer requires Component factories. Please use other APIs where
|
||||
* Component class can be used directly.
|
||||
*/
|
||||
export abstract class ComponentFactory<C> {
|
||||
/**
|
||||
|
||||
@@ -44,6 +44,9 @@ class _NullComponentFactoryResolver implements ComponentFactoryResolver {
|
||||
* does **not** require resolving component factory: component class can be used directly.
|
||||
*
|
||||
* @publicApi
|
||||
*
|
||||
* @deprecated Angular no longer requires Component factories. Please use other APIs where
|
||||
* Component class can be used directly.
|
||||
*/
|
||||
export abstract class ComponentFactoryResolver {
|
||||
static NULL: ComponentFactoryResolver = (/* @__PURE__ */ new _NullComponentFactoryResolver());
|
||||
|
||||
@@ -30,6 +30,9 @@ export abstract class NgModuleRef<T> {
|
||||
* Note: since v13, dynamic component creation via
|
||||
* [`ViewContainerRef.createComponent`](api/core/ViewContainerRef#createComponent)
|
||||
* does **not** require resolving component factory: component class can be used directly.
|
||||
*
|
||||
* @deprecated Angular no longer requires Component factories. Please use other APIs where
|
||||
* Component class can be used directly.
|
||||
*/
|
||||
abstract get componentFactoryResolver(): ComponentFactoryResolver;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user