
committed by
Alex Rickabaugh

parent
0918adf39d
commit
3903e5ebe7
@ -25,6 +25,8 @@ export type InjectableProvider = ValueSansProvider | ExistingSansProvider |
|
||||
|
||||
/**
|
||||
* Type of the Injectable decorator / constructor function.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface InjectableDecorator {
|
||||
/**
|
||||
@ -57,10 +59,11 @@ export interface InjectableDecorator {
|
||||
export interface Injectable { providedIn?: Type<any>|'root'|null; }
|
||||
|
||||
/**
|
||||
* Injectable decorator and metadata.
|
||||
*
|
||||
* @Annotation
|
||||
*/
|
||||
* Injectable decorator and metadata.
|
||||
*
|
||||
* @Annotation
|
||||
* @publicApi
|
||||
*/
|
||||
export const Injectable: InjectableDecorator = makeDecorator(
|
||||
'Injectable', undefined, undefined, undefined,
|
||||
(type: Type<any>, meta: Injectable) => SWITCH_COMPILE_INJECTABLE(type as any, meta));
|
||||
|
@ -47,6 +47,8 @@ import {defineInjectable} from './defs';
|
||||
*
|
||||
* {@example core/di/ts/injector_spec.ts region='ShakableInjectionToken'}
|
||||
*
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class InjectionToken<T> {
|
||||
/** @internal */
|
||||
|
@ -57,7 +57,7 @@ export class NullInjector implements Injector {
|
||||
*
|
||||
* {@example core/di/ts/injector_spec.ts region='injectInjector'}
|
||||
*
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export abstract class Injector {
|
||||
static THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
|
||||
@ -399,6 +399,8 @@ function staticError(text: string, obj: any): Error {
|
||||
|
||||
/**
|
||||
* Injection flags for DI.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const enum InjectFlags {
|
||||
Default = 0b0000,
|
||||
|
@ -15,6 +15,8 @@ import {EMPTY_ARRAY} from '../view/util';
|
||||
|
||||
/**
|
||||
* Type of the Inject decorator / constructor function.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface InjectDecorator {
|
||||
/**
|
||||
@ -40,6 +42,8 @@ export interface InjectDecorator {
|
||||
|
||||
/**
|
||||
* Type of the Inject metadata.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface Inject {
|
||||
/**
|
||||
@ -52,19 +56,22 @@ export interface Inject {
|
||||
* Inject decorator and metadata.
|
||||
*
|
||||
* @Annotation
|
||||
* @publicApi
|
||||
*/
|
||||
export const Inject: InjectDecorator = makeParamDecorator('Inject', (token: any) => ({token}));
|
||||
|
||||
|
||||
/**
|
||||
* Type of the Optional decorator / constructor function.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface OptionalDecorator {
|
||||
/**
|
||||
* A constructor parameter decorator that marks a dependency as optional.
|
||||
*
|
||||
* The DI framework provides null if the dependency is not found.
|
||||
* For example, the following code allows the possibility of a null result:
|
||||
* For example, the following code allows the possibility of a null result:
|
||||
*
|
||||
* {@example core/di/ts/metadata_spec.ts region='Optional'}
|
||||
*
|
||||
@ -76,6 +83,8 @@ export interface OptionalDecorator {
|
||||
|
||||
/**
|
||||
* Type of the Optional metadata.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface Optional {}
|
||||
|
||||
@ -83,11 +92,14 @@ export interface Optional {}
|
||||
* Optional decorator and metadata.
|
||||
*
|
||||
* @Annotation
|
||||
* @publicApi
|
||||
*/
|
||||
export const Optional: OptionalDecorator = makeParamDecorator('Optional');
|
||||
|
||||
/**
|
||||
* Type of the Self decorator / constructor function.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface SelfDecorator {
|
||||
/**
|
||||
@ -110,6 +122,8 @@ export interface SelfDecorator {
|
||||
|
||||
/**
|
||||
* Type of the Self metadata.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface Self {}
|
||||
|
||||
@ -117,12 +131,15 @@ export interface Self {}
|
||||
* Self decorator and metadata.
|
||||
*
|
||||
* @Annotation
|
||||
* @publicApi
|
||||
*/
|
||||
export const Self: SelfDecorator = makeParamDecorator('Self');
|
||||
|
||||
|
||||
/**
|
||||
* Type of the SkipSelf decorator / constructor function.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface SkipSelfDecorator {
|
||||
/**
|
||||
@ -145,7 +162,7 @@ export interface SkipSelfDecorator {
|
||||
/**
|
||||
* Type of the SkipSelf metadata.
|
||||
*
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface SkipSelf {}
|
||||
|
||||
@ -153,11 +170,14 @@ export interface SkipSelf {}
|
||||
* SkipSelf decorator and metadata.
|
||||
*
|
||||
* @Annotation
|
||||
* @publicApi
|
||||
*/
|
||||
export const SkipSelf: SkipSelfDecorator = makeParamDecorator('SkipSelf');
|
||||
|
||||
/**
|
||||
* Type of the Host decorator / constructor function.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface HostDecorator {
|
||||
/**
|
||||
@ -167,7 +187,7 @@ export interface HostDecorator {
|
||||
*
|
||||
* @see ["Dependency Injection Guide"](guide/dependency-injection).
|
||||
*
|
||||
* @usageNotes
|
||||
* @usageNotes
|
||||
*
|
||||
* {@example core/di/ts/metadata_spec.ts region='Host'}
|
||||
*/
|
||||
@ -177,6 +197,8 @@ export interface HostDecorator {
|
||||
|
||||
/**
|
||||
* Type of the Host metadata.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface Host {}
|
||||
|
||||
@ -184,5 +206,6 @@ export interface Host {}
|
||||
* Host decorator and metadata.
|
||||
*
|
||||
* @Annotation
|
||||
* @publicApi
|
||||
*/
|
||||
export const Host: HostDecorator = makeParamDecorator('Host');
|
||||
|
@ -40,6 +40,8 @@ export interface ValueSansProvider {
|
||||
* ### Multi-value example
|
||||
*
|
||||
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface ValueProvider extends ValueSansProvider {
|
||||
/**
|
||||
@ -191,6 +193,8 @@ export interface ExistingSansProvider {
|
||||
* ### Multi-value example
|
||||
*
|
||||
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface ExistingProvider extends ExistingSansProvider {
|
||||
/**
|
||||
@ -248,6 +252,8 @@ export interface FactorySansProvider {
|
||||
* ### Multi-value example
|
||||
*
|
||||
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface FactoryProvider extends FactorySansProvider {
|
||||
/**
|
||||
@ -270,6 +276,8 @@ export interface FactoryProvider extends FactorySansProvider {
|
||||
* @see `ValueProvider`
|
||||
* @see `ExistingProvider`
|
||||
* @see `FactoryProvider`
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export type StaticProvider = ValueProvider | ExistingProvider | StaticClassProvider |
|
||||
ConstructorProvider | FactoryProvider | any[];
|
||||
@ -287,6 +295,8 @@ export type StaticProvider = ValueProvider | ExistingProvider | StaticClassProvi
|
||||
* ### Example
|
||||
*
|
||||
* {@example core/di/ts/provider_spec.ts region='TypeProvider'}
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface TypeProvider extends Type<any> {}
|
||||
|
||||
@ -326,6 +336,8 @@ export interface ClassSansProvider {
|
||||
* ### Multi-value example
|
||||
*
|
||||
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface ClassProvider extends ClassSansProvider {
|
||||
/**
|
||||
@ -348,6 +360,8 @@ export interface ClassProvider extends ClassSansProvider {
|
||||
* @see `TypeProvider`
|
||||
* @see `ClassProvider`
|
||||
* @see `StaticProvider`
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export type Provider = TypeProvider | ValueProvider | ClassProvider | ConstructorProvider |
|
||||
ExistingProvider | FactoryProvider | any[];
|
||||
|
@ -51,6 +51,7 @@ const UNDEFINED = new Object();
|
||||
* resolve all of the object's dependencies automatically.
|
||||
*
|
||||
* @deprecated from v5 - slow and brings in a lot of code, Use `Injector.create` instead.
|
||||
* @publicApi
|
||||
*/
|
||||
export abstract class ReflectiveInjector implements Injector {
|
||||
/**
|
||||
@ -140,7 +141,6 @@ export abstract class ReflectiveInjector implements Injector {
|
||||
* var injector = ReflectiveInjector.fromResolvedProviders(providers);
|
||||
* expect(injector.get(Car) instanceof Car).toBe(true);
|
||||
* ```
|
||||
* @publicApi
|
||||
*/
|
||||
static fromResolvedProviders(providers: ResolvedReflectiveProvider[], parent?: Injector):
|
||||
ReflectiveInjector {
|
||||
|
@ -24,7 +24,9 @@ import {resolveForwardRef} from './forward_ref';
|
||||
* `Key` should not be created directly. {@link ReflectiveInjector} creates keys automatically when
|
||||
* resolving
|
||||
* providers.
|
||||
*
|
||||
* @deprecated No replacement
|
||||
* @publicApi
|
||||
*/
|
||||
export class ReflectiveKey {
|
||||
public readonly displayName: string;
|
||||
|
Reference in New Issue
Block a user