feat(ivy): support injection even if no injector present (#23345)

- Remove default injection value from `inject` / `directiveInject` since
  it is not possible to set using annotations.
- Module `Injector` is stored on `LView` instead of `LInjector` data
  structure because it can change only at `LView` level. (More efficient)
- Add `ngInjectableDef` to `IterableDiffers` so that existing tests can
  pass as well as enable `IterableDiffers` to be injectable without
  `Injector`

PR Close #23345
This commit is contained in:
Misko Hevery
2018-04-12 15:54:16 -07:00
committed by Igor Minar
parent 6f213a74f2
commit da31db757b
21 changed files with 175 additions and 105 deletions

View File

@ -7,7 +7,6 @@
*/
import {ChangeDetectorRef} from '../../change_detection/change_detector_ref';
import {Injector} from '../../di/injector';
import {ElementRef} from '../../linker/element_ref';
import {TemplateRef} from '../../linker/template_ref';
import {ViewContainerRef} from '../../linker/view_container_ref';
@ -69,8 +68,6 @@ export interface LInjector {
cbf6: number;
cbf7: number;
injector: Injector|null;
/** Stores the TemplateRef so subsequent injections of the TemplateRef get the same instance. */
templateRef: TemplateRef<any>|null;

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {Injector} from '../../di/injector';
import {LContainer} from './container';
import {ComponentTemplate, DirectiveDef, DirectiveDefList, PipeDef, PipeDefList} from './definition';
import {LElementNode, LViewNode, TNode} from './node';
@ -189,6 +190,11 @@ export interface LView {
* Queries active for this view - nodes from a view are reported to those queries
*/
queries: LQueries|null;
/**
* An optional Module Injector to be used as fall back after Element Injectors are consulted.
*/
injector: Injector|null;
}
/** Flags associated with an LView (saved in LView.flags) */