Skip to content

Commit

Permalink
fixup! feat(ivy): support injection even if no injector present
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery committed Apr 13, 2018
1 parent e2a3a2f commit 27674e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions packages/core/src/di/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ import {ClassProvider, ClassSansProvider, ConstructorProvider, ConstructorSansPr
*/
export interface InjectableDef<T> {
/**
* Specifies that the given type belongs to a particular `InjectorDef`, `NgModule`, or a special
* scope (e.g. `'root'`). A value of `null` indicates that the injectable does not belong to any
* scope.
* Specifies that the given type belongs to a particular injector:
* - `InjectorType` such as `NgModule`,
* - `'root'` the root injector
* - `'any'` all injectors.
* - `null`, does not belong to any injector. Must be explicitly listed in the injector
* `providers`.
*/
providedIn: InjectorType<any>|'root'|'any'|null;

Expand Down Expand Up @@ -115,11 +118,11 @@ export interface InjectorTypeWithProviders<T> {
* @experimental
*/
export function defineInjectable<T>(opts: {
providedIn?: Type<any>| 'root' | null,
providedIn?: Type<any>| 'root' | 'any' | null,
factory: () => T,
}): InjectableDef<T> {
return {
providedIn: (opts.providedIn as InjectorType<any>| 'root' | null | undefined) || null,
providedIn: opts.providedIn as any || null,
factory: opts.factory,
value: undefined,
};
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/render3/interfaces/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export interface LView {
queries: LQueries|null;

/**
* Injector to be used (if any).
* An optional Module Injector to be used as fall back after Element Injectors are consulted.
*/
injector: Injector|null;
}
Expand Down

0 comments on commit 27674e3

Please sign in to comment.