*
*
* Use this API as the last resort when direct access to DOM is needed. Use templating and
* data-binding provided by Angular instead. Alternatively you can take a look at {@link
* Renderer2}
* which provides API that can safely be used even when direct access to native elements is not
* supported.
*
*
* Relying on direct DOM access creates tight coupling between your application and rendering
* layers which will make it impossible to separate the two and deploy your application into a
* web worker.
*
*
*
*/
nativeElement: T;
constructor(nativeElement: T);
}
/**
* Configures the `Injector` to return a value of another `useExisting` token.
*
* @see ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
*
* {@example core/di/ts/provider_spec.ts region='ExistingProvider'}
*
* ### Multi-value example
*
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
*
* @publicApi
*/
declare interface ExistingProvider extends ExistingSansProvider {
/**
* An injection token. Typically an instance of `Type` or `InjectionToken`, but can be `any`.
*/
provide: any;
/**
* When true, 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.
*/
multi?: boolean;
}
/**
* Configures the `Injector` to return a value of another `useExisting` token.
*
* @see `ExistingProvider`
* @see ["Dependency Injection Guide"](guide/dependency-injection).
*
* @publicApi
*/
declare interface ExistingSansProvider {
/**
* Existing `token` to return. (Equivalent to `injector.get(useExisting)`)
*/
useExisting: any;
}
/**
* Configures the `Injector` to return a value by invoking a `useFactory` function.
* @see ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
*
* {@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'}
*
* @publicApi
*/
declare interface FactoryProvider extends FactorySansProvider {
/**
* An injection token. (Typically an instance of `Type` or `InjectionToken`, but can be `any`).
*/
provide: any;
/**
* When true, 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.
*/
multi?: boolean;
}
/**
* Configures the `Injector` to return a value by invoking a `useFactory` function.
*
* @see `FactoryProvider`
* @see ["Dependency Injection Guide"](guide/dependency-injection).
*
* @publicApi
*/
declare interface FactorySansProvider {
/**
* A function to invoke to create a value for this `token`. The function is invoked with
* resolved values of `token`s in the `deps` field.
*/
useFactory: Function;
/**
* A list of `token`s to be resolved by the injector. The list of values is then
* used as arguments to the `useFactory` function.
*/
deps?: any[];
}
/**
* Injection flags for DI.
*
* @publicApi
*/
declare enum InjectFlags {
/** Check self and check parent injector if needed */
Default = 0,
/**
* Specifies that an injector should retrieve a dependency from any injector until reaching the
* host element of the current component. (Only used with Element Injector)
*/
Host = 1,
/** Don't ascend to ancestors of the node requesting injection. */
Self = 2,
/** Skip the node that is requesting injection. */
SkipSelf = 4,
/** Inject `defaultValue` instead if token not found. */
Optional = 8
}
/**
* Creates a token that can be used in a DI Provider.
*
* Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a
* runtime representation) such as when injecting an interface, callable type, array or
* parameterized type.
*
* `InjectionToken` is parameterized on `T` which is the type of object which will be returned by
* the `Injector`. This provides additional level of type safety.
*
* ```
* interface MyInterface {...}
* var myInterface = injector.get(new InjectionToken