diff --git a/packages/core/src/render3/features/standalone_feature.ts b/packages/core/src/render3/features/standalone_feature.ts index f35c6e0cec0..545c1f340a5 100644 --- a/packages/core/src/render3/features/standalone_feature.ts +++ b/packages/core/src/render3/features/standalone_feature.ts @@ -13,7 +13,11 @@ import {OnDestroy} from '../../interface/lifecycle_hooks'; import {ComponentDef} from '../interfaces/definition'; import {createEnvironmentInjector} from '../ng_module_ref'; -// TODO(pk): document +/** + * A service used by the framework to create instances of standalone injectors. Those injectors are + * created on demand in case of dynamic component instantiation and contain ambient providers + * collected from the imports graph rooted at a given standalone component. + */ class StandaloneService implements OnDestroy { cachedInjectors = new Map, EnvironmentInjector|null>(); @@ -60,7 +64,12 @@ class StandaloneService implements OnDestroy { } /** - * TODO(pk): documentation + * A feature that acts as a setup code for the {@see StandaloneService}. + * + * The most important responsaibility of this feature is to expose the "getStandaloneInjector" + * function (an entry points to a standalone injector creation) on a component definition object. We + * go through the features infrastructure to make sure that the standalone injector creation logic + * is tree-shakable and not included in applications that don't use standalone components. * * @codeGenApi */ diff --git a/packages/core/src/render3/interfaces/definition.ts b/packages/core/src/render3/interfaces/definition.ts index a331506b0ff..505e9239145 100644 --- a/packages/core/src/render3/interfaces/definition.ts +++ b/packages/core/src/render3/interfaces/definition.ts @@ -322,6 +322,9 @@ export interface ComponentDef extends DirectiveDef { */ tView: TView|null; + /** + * A function added by the {@see ɵɵStandaloneFeature} and used by the framework to create standalone injectors. + */ getStandaloneInjector: ((parentInjector: EnvironmentInjector) => EnvironmentInjector | null)|null; /**