docs: fix invalid headings (#24000)

PR Close #24000
This commit is contained in:
Pete Bacon Darwin
2018-05-18 16:13:00 +01:00
committed by Miško Hevery
parent 77309e2ea4
commit e6516b0229
26 changed files with 255 additions and 473 deletions

View File

@ -14,6 +14,7 @@ import {stringify} from '../util';
/**
* An interface that a function passed into {@link forwardRef} has to implement.
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref_fn'}
@ -25,10 +26,10 @@ export interface ForwardRefFn { (): any; }
* Allows to refer to references which are not yet defined.
*
* For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of
* DI is declared,
* but not yet defined. It is also used when the `token` which we use when creating a query is not
* yet defined.
* DI is declared, but not yet defined. It is also used when the `token` which we use when creating
* a query is not yet defined.
*
* @usageNotes
* ### Example
* {@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'}
* @experimental
@ -44,11 +45,12 @@ export function forwardRef(forwardRefFn: ForwardRefFn): Type<any> {
*
* Acts as the identity function when given a non-forward-ref value.
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'}
*
* See: {@link forwardRef}
* @see `forwardRef`
* @experimental
*/
export function resolveForwardRef(type: any): any {

View File

@ -30,32 +30,23 @@ export type InjectableProvider = ValueSansProvider | ExistingSansProvider |
/**
* Type of the Injectable decorator / constructor function.
*
*
*/
export interface InjectableDecorator {
/**
* A marker metadata that marks a class as available to `Injector` for creation.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ```
* @Injectable()
* class Car {}
* ```
*
* @description
* A marker metadata that marks a class as available to {@link Injector} for creation.
*
* For more details, see the ["Dependency Injection Guide"(guide/dependency-injection).
*
* ### Example
*
* {@example core/di/ts/metadata_spec.ts region='Injectable'}
*
* {@link Injector} will throw an error when trying to instantiate a class that
* `Injector` will throw an error when trying to instantiate a class that
* does not have `@Injectable` marker, as shown in the example below.
*
* {@example core/di/ts/metadata_spec.ts region='InjectableThrows'}
*
*
*/
(): any;
(options?: {providedIn: Type<any>| 'root' | null}&InjectableProvider): any;
@ -125,7 +116,6 @@ function preR3InjectableCompile(
/**
* Injectable decorator and metadata.
*
*
* @Annotation
*/
export const Injectable: InjectableDecorator = makeDecorator(

View File

@ -36,16 +36,14 @@ import {InjectableDef, defineInjectable} from './defs';
* overrides the above behavior and marks the token as belonging to a particular `@NgModule`. As
* mentioned above, `'root'` is the default value for `providedIn`.
*
* ### Example
*
* #### Tree-shakeable InjectionToken
*
* {@example core/di/ts/injector_spec.ts region='ShakeableInjectionToken'}
*
* #### Plain InjectionToken
* @usageNotes
* ### Basic Example
*
* {@example core/di/ts/injector_spec.ts region='InjectionToken'}
*
* ### Tree-shakeable Example
*
* {@example core/di/ts/injector_spec.ts region='ShakeableInjectionToken'}
*
*/
export class InjectionToken<T> {

View File

@ -43,23 +43,17 @@ export class NullInjector implements Injector {
}
/**
* @usageNotes
* ```
* const injector: Injector = ...;
* injector.get(...);
* ```
*
* @description
*
* Concrete injectors implement this interface.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/injector_spec.ts region='Injector'}
*
* `Injector` returns itself when given `Injector` as a token:
*
* {@example core/di/ts/injector_spec.ts region='injectInjector'}
*
*
@ -92,6 +86,7 @@ export abstract class Injector {
/**
* Create a new Injector which is configure using `StaticProvider`s.
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='ConstructorProvider'}
@ -450,7 +445,10 @@ export function setCurrentInjector(injector: Injector | null | undefined): Injec
* Injects a token from the currently active injector.
*
* This function must be used in the context of a factory function such as one defined for an
* `InjectionToken`, and will throw an error if not called from such a context. For example:
* `InjectionToken`, and will throw an error if not called from such a context.
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/injector_spec.ts region='ShakeableInjectionToken'}
*

View File

@ -15,36 +15,24 @@ import {EMPTY_ARRAY} from '../view/util';
/**
* Type of the Inject decorator / constructor function.
*
*
*/
export interface InjectDecorator {
/**
* @usageNotes
* ```
* @Injectable()
* class Car {
* constructor(@Inject("MyEngine") public engine:Engine) {}
* }
* ```
*
* @description
* A parameter decorator that specifies a dependency.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/metadata_spec.ts region='Inject'}
*
* When `@Inject()` is not present, {@link Injector} will use the type annotation of the
* When `@Inject()` is not present, `Injector` will use the type annotation of the
* parameter.
*
* ### Example
*
* {@example core/di/ts/metadata_spec.ts region='InjectWithoutDecorator'}
*
*
*/
(token: any): any;
new (token: any): Inject;
@ -52,15 +40,12 @@ export interface InjectDecorator {
/**
* Type of the Inject metadata.
*
*
*/
export interface Inject { token: any; }
/**
* Inject decorator and metadata.
*
*
* @Annotation
*/
export const Inject: InjectDecorator = makeParamDecorator('Inject', (token: any) => ({token}));
@ -68,30 +53,18 @@ export const Inject: InjectDecorator = makeParamDecorator('Inject', (token: any)
/**
* Type of the Optional decorator / constructor function.
*
*
*/
export interface OptionalDecorator {
/**
* @usageNotes
* ```
* @Injectable()
* class Car {
* constructor(@Optional() public engine:Engine) {}
* }
* ```
*
* @description
* A parameter metadata that marks a dependency as optional.
* {@link Injector} provides `null` if the dependency is not found.
* `Injector` provides `null` if the dependency is not found.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/metadata_spec.ts region='Optional'}
*
*
*/
(): any;
new (): Optional;
@ -99,44 +72,29 @@ export interface OptionalDecorator {
/**
* Type of the Optional metadata.
*
*
*/
export interface Optional {}
/**
* Optional decorator and metadata.
*
*
* @Annotation
*/
export const Optional: OptionalDecorator = makeParamDecorator('Optional');
/**
* Type of the Self decorator / constructor function.
*
*
*/
export interface SelfDecorator {
/**
* @usageNotes
* ```
* @Injectable()
* class Car {
* constructor(@Self() public engine:Engine) {}
* }
* ```
*
* @description
* Specifies that an {@link Injector} should retrieve a dependency only from itself.
* Specifies that an `Injector` should retrieve a dependency only from itself.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/metadata_spec.ts region='Self'}
*
*
*/
(): any;
new (): Self;
@ -144,15 +102,12 @@ export interface SelfDecorator {
/**
* Type of the Self metadata.
*
*
*/
export interface Self {}
/**
* Self decorator and metadata.
*
*
* @Annotation
*/
export const Self: SelfDecorator = makeParamDecorator('Self');
@ -160,29 +115,17 @@ export const Self: SelfDecorator = makeParamDecorator('Self');
/**
* Type of the SkipSelf decorator / constructor function.
*
*
*/
export interface SkipSelfDecorator {
/**
* @usageNotes
* ```
* @Injectable()
* class Car {
* constructor(@SkipSelf() public engine:Engine) {}
* }
* ```
*
* @description
* Specifies that the dependency resolution should start from the parent injector.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/metadata_spec.ts region='SkipSelf'}
*
*
*/
(): any;
new (): SkipSelf;
@ -198,37 +141,24 @@ export interface SkipSelf {}
/**
* SkipSelf decorator and metadata.
*
*
* @Annotation
*/
export const SkipSelf: SkipSelfDecorator = makeParamDecorator('SkipSelf');
/**
* Type of the Host decorator / constructor function.
*
*
*/
export interface HostDecorator {
/**
* @usageNotes
* ```
* @Injectable()
* class Car {
* constructor(@Host() public engine:Engine) {}
* }
* ```
*
* @description
* Specifies that an injector should retrieve a dependency from any injector until
* reaching the host element of the current component.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/metadata_spec.ts region='Host'}
*
*
*/
(): any;
new (): Host;
@ -236,15 +166,12 @@ export interface HostDecorator {
/**
* Type of the Host metadata.
*
*
*/
export interface Host {}
/**
* Host decorator and metadata.
*
*
* @Annotation
*/
export const Host: HostDecorator = makeParamDecorator('Host');

View File

@ -9,17 +9,11 @@
import {Type} from '../type';
/**
* @usageNotes
* ```
* @Injectable(SomeModule, {useValue: 'someValue'})
* class SomeClass {}
* ```
*
* @description
* Configures the `Injector` to return a value for a token.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='ValueSansProvider'}
@ -34,21 +28,18 @@ export interface ValueSansProvider {
}
/**
* @usageNotes
* ```
* const provider: ValueProvider = {provide: 'someToken', useValue: 'someValue'};
* ```
*
* @description
* Configures the `Injector` to return a value for a token.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='ValueProvider'}
*
* ### Multi-value example
*
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
*/
export interface ValueProvider extends ValueSansProvider {
/**
@ -59,26 +50,16 @@ export interface ValueProvider extends ValueSansProvider {
/**
* If true, then injector returns an array of instances. This is useful to allow multiple
* providers spread across many files to provide configuration information to a common token.
*
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
*/
multi?: boolean;
}
/**
* @usageNotes
* ```
* @Injectable(SomeModule, {useClass: MyService, deps: []})
* class MyService {}
* ```
*
* @description
* Configures the `Injector` to return an instance of `useClass` for a token.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='StaticClassSansProvider'}
@ -100,27 +81,22 @@ export interface StaticClassSansProvider {
}
/**
* @usageNotes
* ```
* @Injectable()
* class MyService {}
*
* const provider: ClassProvider = {provide: 'someToken', useClass: MyService, deps: []};
* ```
*
* @description
* Configures the `Injector` to return an instance of `useClass` for a token.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='StaticClassProvider'}
*
* Note that following two providers are not equal:
*
* {@example core/di/ts/provider_spec.ts region='StaticClassProviderDifference'}
*
* ### Multi-value example
*
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
*/
export interface StaticClassProvider extends StaticClassSansProvider {
/**
@ -131,26 +107,23 @@ export interface StaticClassProvider extends StaticClassSansProvider {
/**
* If true, then injector returns an array of instances. This is useful to allow multiple
* providers spread across many files to provide configuration information to a common token.
*
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
*/
multi?: boolean;
}
/**
* Configures the `Injector` to return an instance of a token.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* ```
* @Injectable(SomeModule, {deps: []})
* class MyService {}
* ```
*
* @description
* Configures the `Injector` to return an instance of a token.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @experimental
*/
export interface ConstructorSansProvider {
@ -162,24 +135,18 @@ export interface ConstructorSansProvider {
}
/**
* @usageNotes
* ```
* @Injectable()
* class MyService {}
*
* const provider: ClassProvider = {provide: MyClass, deps: []};
* ```
*
* @description
* Configures the `Injector` to return an instance of a token.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='ConstructorProvider'}
*
* ### Multi-value example
*
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
*/
export interface ConstructorProvider extends ConstructorSansProvider {
/**
@ -190,31 +157,19 @@ export interface ConstructorProvider extends ConstructorSansProvider {
/**
* If true, then injector returns an array of instances. This is useful to allow multiple
* providers spread across many files to provide configuration information to a common token.
*
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
*/
multi?: boolean;
}
/**
* @usageNotes
* ```
* @Injectable(SomeModule, {useExisting: 'someOtherToken'})
* class SomeClass {}
* ```
*
* @description
* Configures the `Injector` to return a value of another `useExisting` token.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='ExistingSansProvider'}
*
*
*/
export interface ExistingSansProvider {
/**
@ -224,21 +179,18 @@ export interface ExistingSansProvider {
}
/**
* @usageNotes
* ```
* const provider: ExistingProvider = {provide: 'someToken', useExisting: 'someOtherToken'};
* ```
*
* @description
* Configures the `Injector` to return a value of another `useExisting` token.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='ExistingProvider'}
*
* ### Multi-value example
*
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
*/
export interface ExistingProvider extends ExistingSansProvider {
/**
@ -249,34 +201,22 @@ export interface ExistingProvider extends ExistingSansProvider {
/**
* If true, then injector returns an array of instances. This is useful to allow multiple
* providers spread across many files to provide configuration information to a common token.
*
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
*/
multi?: boolean;
}
/**
* @usageNotes
* ```
* function serviceFactory() { ... }
*
* @Injectable(SomeModule, {useFactory: serviceFactory, deps: []})
* class SomeClass {}
* ```
*
* @description
* Configures the `Injector` to return a value by invoking a `useFactory` function.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='FactorySansProvider'}
*
* @experimental
*/
*/
export interface FactorySansProvider {
/**
* A function to invoke to create a value for this `token`. The function is invoked with
@ -292,26 +232,22 @@ export interface FactorySansProvider {
}
/**
* @usageNotes
* ```
* function serviceFactory() { ... }
*
* const provider: FactoryProvider = {provide: 'someToken', useFactory: serviceFactory, deps: []};
* ```
*
* @description
* Configures the `Injector` to return a value by invoking a `useFactory` function.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='FactoryProvider'}
*
* Dependencies can also be marked as optional:
*
* {@example core/di/ts/provider_spec.ts region='FactoryProviderOptionalDeps'}
*
* ### Multi-value example
*
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
*/
export interface FactoryProvider extends FactorySansProvider {
/**
@ -322,39 +258,24 @@ export interface FactoryProvider extends FactorySansProvider {
/**
* If true, then injector returns an array of instances. This is useful to allow multiple
* providers spread across many files to provide configuration information to a common token.
*
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
*/
multi?: boolean;
}
/**
* @usageNotes
* See {@link ValueProvider}, {@link ExistingProvider}, {@link FactoryProvider}.
*
* @description
* Describes how the `Injector` should be configured in a static way (Without reflection).
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
*
* @see `ValueProvider`
* @see `ExistingProvider`
* @see `FactoryProvider`
*/
export type StaticProvider = ValueProvider | ExistingProvider | StaticClassProvider |
ConstructorProvider | FactoryProvider | any[];
/**
* @usageNotes
* ```
* @Injectable()
* class MyService {}
*
* const provider: TypeProvider = MyService;
* ```
*
* @description
* Configures the `Injector` to return an instance of `Type` when `Type' is used as the token.
*
* Create an instance by invoking the `new` operator and supplying additional arguments.
@ -362,29 +283,19 @@ export type StaticProvider = ValueProvider | ExistingProvider | StaticClassProvi
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='TypeProvider'}
*
*
*/
export interface TypeProvider extends Type<any> {}
/**
* @usageNotes
* ```
*
* class SomeClassImpl {}
*
* @Injectable(SomeModule, {useClass: SomeClassImpl})
* class SomeClass {}
* ```
*
* @description
* Configures the `Injector` to return a value by invoking a `useClass` function.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='ClassSansProvider'}
@ -399,27 +310,22 @@ export interface ClassSansProvider {
}
/**
* @usageNotes
* ```
* @Injectable()
* class MyService {}
*
* const provider: ClassProvider = {provide: 'someToken', useClass: MyService};
* ```
*
* @description
* Configures the `Injector` to return an instance of `useClass` for a token.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='ClassProvider'}
*
* Note that following two providers are not equal:
*
* {@example core/di/ts/provider_spec.ts region='ClassProviderDifference'}
*
* ### Multi-value example
*
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
*/
export interface ClassProvider extends ClassSansProvider {
/**
@ -430,24 +336,18 @@ export interface ClassProvider extends ClassSansProvider {
/**
* If true, then injector returns an array of instances. This is useful to allow multiple
* providers spread across many files to provide configuration information to a common token.
*
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
*/
multi?: boolean;
}
/**
* @usageNotes
* See {@link TypeProvider}, {@link ClassProvider}, {@link StaticProvider}.
*
* @description
* Describes how the `Injector` should be configured.
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
*
* @see `TypeProvider`
* @see `ClassProvider`
* @see `StaticProvider`
*/
export type Provider = TypeProvider | ValueProvider | ClassProvider | ConstructorProvider |
ExistingProvider | FactoryProvider | any[];

View File

@ -70,6 +70,7 @@ function addKey(this: InjectionError, injector: ReflectiveInjector, key: Reflect
* Thrown when trying to retrieve a dependency by key from {@link Injector}, but the
* {@link Injector} does not have a {@link Provider} for the given key.
*
* @usageNotes
* ### Example
*
* ```typescript
@ -90,6 +91,7 @@ export function noProviderError(injector: ReflectiveInjector, key: ReflectiveKey
/**
* Thrown when dependencies form a cycle.
*
* @usageNotes
* ### Example
*
* ```typescript
@ -116,6 +118,7 @@ export function cyclicDependencyError(
* The `InstantiationError` class contains the original error plus the dependency graph which caused
* this object to be instantiated.
*
* @usageNotes
* ### Example
*
* ```typescript
@ -149,6 +152,7 @@ export function instantiationError(
* Thrown when an object other then {@link Provider} (or `Type`) is passed to {@link Injector}
* creation.
*
* @usageNotes
* ### Example
*
* ```typescript
@ -166,6 +170,7 @@ export function invalidProviderError(provider: any) {
* Lack of annotation information prevents the {@link Injector} from determining which dependencies
* need to be injected into the constructor.
*
* @usageNotes
* ### Example
*
* ```typescript
@ -209,6 +214,7 @@ export function noAnnotationError(typeOrFunc: Type<any>| Function, params: any[]
/**
* Thrown when getting an object by index.
*
* @usageNotes
* ### Example
*
* ```typescript
@ -228,6 +234,7 @@ export function outOfBoundsError(index: number) {
/**
* Thrown when a multi provider and a regular provider are bound to the same token.
*
* @usageNotes
* ### Example
*
* ```typescript

View File

@ -26,6 +26,7 @@ const UNDEFINED = new Object();
* In typical use, application code asks for the dependencies in the constructor and they are
* resolved by the `Injector`.
*
* @usageNotes
* ### Example
*
* The following example creates an `Injector` configured to create `Engine` and `Car`.
@ -56,8 +57,9 @@ export abstract class ReflectiveInjector implements Injector {
* Turns an array of provider definitions into an array of resolved providers.
*
* A resolution is a process of flattening multiple nested arrays and converting individual
* providers into an array of {@link ResolvedReflectiveProvider}s.
* providers into an array of `ResolvedReflectiveProvider`s.
*
* @usageNotes
* ### Example
*
* ```typescript
@ -83,7 +85,6 @@ export abstract class ReflectiveInjector implements Injector {
* });
* ```
*
* See {@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders} for more info.
*/
static resolve(providers: Provider[]): ResolvedReflectiveProvider[] {
return resolveReflectiveProviders(providers);
@ -92,9 +93,10 @@ export abstract class ReflectiveInjector implements Injector {
/**
* Resolves an array of providers and creates an injector from those providers.
*
* The passed-in providers can be an array of `Type`, {@link Provider},
* The passed-in providers can be an array of `Type`, `Provider`,
* or a recursive array of more providers.
*
* @usageNotes
* ### Example
*
* ```typescript
@ -110,11 +112,6 @@ export abstract class ReflectiveInjector implements Injector {
* var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
* expect(injector.get(Car) instanceof Car).toBe(true);
* ```
*
* This function is slower than the corresponding `fromResolvedProviders`
* because it needs to resolve the passed-in providers first.
* See {@link ReflectiveInjector#resolve resolve} and
* {@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders}.
*/
static resolveAndCreate(providers: Provider[], parent?: Injector): ReflectiveInjector {
const ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
@ -126,6 +123,7 @@ export abstract class ReflectiveInjector implements Injector {
*
* This API is the recommended way to construct injectors in performance-sensitive parts.
*
* @usageNotes
* ### Example
*
* ```typescript
@ -156,6 +154,7 @@ export abstract class ReflectiveInjector implements Injector {
* <!-- TODO: Add a link to the section of the user guide talking about hierarchical injection.
* -->
*
* @usageNotes
* ### Example
*
* ```typescript
@ -172,9 +171,10 @@ export abstract class ReflectiveInjector implements Injector {
* <!-- TODO: Add a link to the section of the user guide talking about hierarchical injection.
* -->
*
* The passed-in providers can be an array of `Type`, {@link Provider},
* The passed-in providers can be an array of `Type`, `Provider`,
* or a recursive array of more providers.
*
* @usageNotes
* ### Example
*
* ```typescript
@ -188,11 +188,6 @@ export abstract class ReflectiveInjector implements Injector {
* expect(child.get(ChildProvider) instanceof ChildProvider).toBe(true);
* expect(child.get(ParentProvider)).toBe(parent.get(ParentProvider));
* ```
*
* This function is slower than the corresponding `createChildFromResolved`
* because it needs to resolve the passed-in providers first.
* See {@link ReflectiveInjector#resolve resolve} and
* {@link ReflectiveInjector#createChildFromResolved createChildFromResolved}.
*/
abstract resolveAndCreateChild(providers: Provider[]): ReflectiveInjector;
@ -204,6 +199,7 @@ export abstract class ReflectiveInjector implements Injector {
*
* This API is the recommended way to construct injectors in performance-sensitive parts.
*
* @usageNotes
* ### Example
*
* ```typescript
@ -228,6 +224,7 @@ export abstract class ReflectiveInjector implements Injector {
*
* The created object does not get cached by the injector.
*
* @usageNotes
* ### Example
*
* ```typescript
@ -254,6 +251,7 @@ export abstract class ReflectiveInjector implements Injector {
*
* The created object does not get cached by the injector.
*
* @usageNotes
* ### Example
*
* ```typescript

View File

@ -36,9 +36,10 @@ export class ReflectiveDependency {
const _EMPTY_LIST: any[] = [];
/**
* An internal resolved representation of a {@link Provider} used by the {@link Injector}.
* An internal resolved representation of a `Provider` used by the `Injector`.
*
* It is usually created automatically by `Injector.resolveAndCreate`.
* @usageNotes
* This is usually created automatically by `Injector.resolveAndCreate`.
*
* It can be created manually, as follows:
*
@ -81,8 +82,7 @@ export class ResolvedReflectiveProvider_ implements ResolvedReflectiveProvider {
}
/**
* An internal resolved representation of a factory function created by resolving {@link
* Provider}.
* An internal resolved representation of a factory function created by resolving `Provider`.
* @experimental
*/
export class ResolvedReflectiveFactory {
@ -123,10 +123,10 @@ function resolveReflectiveFactory(provider: NormalizedProvider): ResolvedReflect
}
/**
* Converts the {@link Provider} into {@link ResolvedProvider}.
* Converts the `Provider` into `ResolvedProvider`.
*
* {@link Injector} internally only uses {@link ResolvedProvider}, {@link Provider} contains
* convenience provider syntax.
* `Injector` internally only uses `ResolvedProvider`, `Provider` contains convenience provider
* syntax.
*/
function resolveReflectiveProvider(provider: NormalizedProvider): ResolvedReflectiveProvider {
return new ResolvedReflectiveProvider_(
@ -145,9 +145,8 @@ export function resolveReflectiveProviders(providers: Provider[]): ResolvedRefle
}
/**
* Merges a list of ResolvedProviders into a list where
* each key is contained exactly once and multi providers
* have been merged.
* Merges a list of ResolvedProviders into a list where each key is contained exactly once and
* multi providers have been merged.
*/
export function mergeResolvedReflectiveProviders(
providers: ResolvedReflectiveProvider[],