@@ -12,7 +12,7 @@ import {Injector} from '../di/injector';
1212import { ComponentFactory , ComponentRef } from '../linker/component_factory' ;
1313import { ComponentFactoryBoundToModule , ComponentFactoryResolver } from '../linker/component_factory_resolver' ;
1414import { ElementRef } from '../linker/element_ref' ;
15- import { InternalNgModuleRef , NgModuleFactory , NgModuleRef } from '../linker/ng_module_factory' ;
15+ import { InternalNgModuleRef , NgModuleRef } from '../linker/ng_module_factory' ;
1616import { TemplateRef } from '../linker/template_ref' ;
1717import { ViewContainerRef } from '../linker/view_container_ref' ;
1818import { EmbeddedViewRef , InternalViewRef , ViewRef } from '../linker/view_ref' ;
@@ -22,7 +22,7 @@ import {stringify} from '../util';
2222import { VERSION } from '../version' ;
2323
2424import { callNgModuleLifecycle , initNgModule , resolveNgModuleDep } from './ng_module' ;
25- import { DepFlags , ElementData , NgModuleData , NgModuleDefinition , NgModuleDefinitionFactory , NodeDef , NodeFlags , Services , TemplateData , ViewContainerData , ViewData , ViewDefinitionFactory , ViewState , asElementData , asProviderData , asTextData } from './types' ;
25+ import { DepFlags , ElementData , NgModuleData , NgModuleDefinition , NodeDef , NodeFlags , Services , TemplateData , ViewContainerData , ViewData , ViewDefinitionFactory , ViewState , asElementData , asProviderData , asTextData } from './types' ;
2626import { markParentViewsForCheck , resolveDefinition , rootRenderNodes , splitNamespace , tokenKey , viewParentEl } from './util' ;
2727import { attachEmbeddedView , detachEmbeddedView , moveEmbeddedView , renderDetachView } from './view_attach' ;
2828
@@ -43,14 +43,6 @@ export function getComponentViewDefinitionFactory(componentFactory: ComponentFac
4343 return ( componentFactory as ComponentFactory_ ) . viewDefFactory ;
4444}
4545
46- // Attention: this function is called as top level function.
47- // Putting any logic in here will destroy closure tree shaking!
48- export function createNgModuleFactory (
49- ngModuleType : Type < any > , bootstrapComponents : Type < any > [ ] ,
50- defFactory : NgModuleDefinitionFactory ) : NgModuleFactory < any > {
51- return new NgModuleFactory_ ( ngModuleType , bootstrapComponents , defFactory ) ;
52- }
53-
5446class ComponentFactory_ extends ComponentFactory < any > {
5547 /**
5648 * @internal
@@ -312,7 +304,8 @@ class TemplateRef_ extends TemplateRef<any> implements TemplateData {
312304 constructor ( private _parentView : ViewData , private _def : NodeDef ) { super ( ) ; }
313305
314306 createEmbeddedView ( context : any ) : EmbeddedViewRef < any > {
315- return new ViewRef_ ( Services . createEmbeddedView ( this . _parentView , this . _def , context ) ) ;
307+ return new ViewRef_ ( Services . createEmbeddedView (
308+ this . _parentView , this . _def , this . _def . element ! . template ! , context ) ) ;
316309 }
317310
318311 get elementRef ( ) : ElementRef {
@@ -464,22 +457,10 @@ class RendererAdapter implements RendererV1 {
464457}
465458
466459
467- class NgModuleFactory_ extends NgModuleFactory < any > {
468- constructor (
469- private _moduleType : Type < any > , private _bootstrapComponents : Type < any > [ ] ,
470- private _ngModuleDefFactory : NgModuleDefinitionFactory , ) {
471- // Attention: this ctor is called as top level function.
472- // Putting any logic in here will destroy closure tree shaking!
473- super ( ) ;
474- }
475-
476- get moduleType ( ) : Type < any > { return this . _moduleType ; }
477-
478- create ( parentInjector : Injector | null ) : NgModuleRef < any > {
479- const def = resolveDefinition ( this . _ngModuleDefFactory ) ;
480- return new NgModuleRef_ (
481- this . _moduleType , parentInjector || Injector . NULL , this . _bootstrapComponents , def ) ;
482- }
460+ export function createNgModuleRef (
461+ moduleType : Type < any > , parent : Injector , bootstrapComponents : Type < any > [ ] ,
462+ def : NgModuleDefinition ) : NgModuleRef < any > {
463+ return new NgModuleRef_ ( moduleType , parent , bootstrapComponents , def ) ;
483464}
484465
485466class NgModuleRef_ implements NgModuleData , InternalNgModuleRef < any > {
@@ -488,8 +469,8 @@ class NgModuleRef_ implements NgModuleData, InternalNgModuleRef<any> {
488469 public _providers : any [ ] ;
489470
490471 constructor (
491- private _moduleType : any , public _parent : Injector , public _bootstrapComponents : Type < any > [ ] ,
492- public _def : NgModuleDefinition ) {
472+ private _moduleType : Type < any > , public _parent : Injector ,
473+ public _bootstrapComponents : Type < any > [ ] , public _def : NgModuleDefinition ) {
493474 initNgModule ( this ) ;
494475 }
495476
0 commit comments