@@ -24,7 +24,7 @@ import {Type} from '../type';
2424
2525import { assertDefined , assertGreaterThan , assertLessThan } from './assert' ;
2626import { ComponentFactoryResolver } from './component_ref' ;
27- import { addToViewTree , assertPreviousIsParent , createEmbeddedViewNode , createLContainer , createLNodeObject , createTNode , getPreviousOrParentNode , getRenderer , isComponent , renderEmbeddedTemplate , resolveDirective } from './instructions' ;
27+ import { addToViewTree , assertPreviousIsParent , createEmbeddedViewNode , createLContainer , createLNodeObject , createTNode , getPreviousOrParentNode , getPreviousOrParentTNode , getRenderer , isComponent , renderEmbeddedTemplate , resolveDirective } from './instructions' ;
2828import { VIEWS } from './interfaces/container' ;
2929import { DirectiveDefInternal , RenderFlags } from './interfaces/definition' ;
3030import { LInjector } from './interfaces/injector' ;
@@ -273,10 +273,9 @@ export function injectRenderer2(): Renderer2 {
273273 * @experimental
274274 */
275275export function injectAttribute ( attrNameToInject : string ) : string | undefined {
276- const lNode = getPreviousOrParentNode ( ) ;
276+ const tNode = getPreviousOrParentTNode ( ) ;
277277 ngDevMode && assertNodeOfPossibleTypes (
278- lNode , TNodeType . Container , TNodeType . Element , TNodeType . ElementContainer ) ;
279- const tNode = lNode . tNode ;
278+ tNode , TNodeType . Container , TNodeType . Element , TNodeType . ElementContainer ) ;
280279 ngDevMode && assertDefined ( tNode , 'expecting tNode' ) ;
281280 const attrs = tNode . attrs ;
282281 if ( attrs ) {
@@ -573,8 +572,9 @@ export const QUERY_READ_ELEMENT_REF =
573572
574573export const QUERY_READ_FROM_NODE =
575574 ( new ReadFromInjectorFn < any > ( ( injector : LInjector , node : LNode , directiveIdx : number ) => {
576- ngDevMode && assertNodeOfPossibleTypes (
577- node , TNodeType . Container , TNodeType . Element , TNodeType . ElementContainer ) ;
575+ ngDevMode &&
576+ assertNodeOfPossibleTypes (
577+ node . tNode , TNodeType . Container , TNodeType . Element , TNodeType . ElementContainer ) ;
578578 if ( directiveIdx > - 1 ) {
579579 return node . view [ DIRECTIVES ] ! [ directiveIdx ] ;
580580 }
@@ -605,17 +605,17 @@ class ElementRef implements viewEngine_ElementRef {
605605export function getOrCreateContainerRef ( di : LInjector ) : viewEngine_ViewContainerRef {
606606 if ( ! di . viewContainerRef ) {
607607 const vcRefHost = di . node ;
608+ const hostTNode = vcRefHost . tNode as TElementNode | TContainerNode ;
608609
609610 ngDevMode && assertNodeOfPossibleTypes (
610- vcRefHost , TNodeType . Container , TNodeType . Element , TNodeType . ElementContainer ) ;
611+ hostTNode , TNodeType . Container , TNodeType . Element , TNodeType . ElementContainer ) ;
611612 const hostParent = getParentLNode ( vcRefHost ) ! ;
612613 const lContainer = createLContainer ( hostParent , vcRefHost . view , true ) ;
613614 const comment = vcRefHost . view [ RENDERER ] . createComment ( ngDevMode ? 'container' : '' ) ;
614- const lContainerNode : LContainerNode =
615- createLNodeObject ( TNodeType . Container , vcRefHost . view , hostParent , comment , lContainer ) ;
615+ const lContainerNode : LContainerNode = createLNodeObject (
616+ TNodeType . Container , vcRefHost . view , vcRefHost . nodeInjector , comment , lContainer ) ;
616617 appendChild ( hostParent , comment , vcRefHost . view ) ;
617618
618- const hostTNode = vcRefHost . tNode as TElementNode | TContainerNode ;
619619 if ( ! hostTNode . dynamicContainerNode ) {
620620 hostTNode . dynamicContainerNode =
621621 createTNode ( TNodeType . Container , - 1 , null , null , hostTNode , null ) ;
@@ -785,9 +785,9 @@ class ViewContainerRef implements viewEngine_ViewContainerRef {
785785 */
786786export function getOrCreateTemplateRef < T > ( di : LInjector ) : viewEngine_TemplateRef < T > {
787787 if ( ! di . templateRef ) {
788- ngDevMode && assertNodeType ( di . node , TNodeType . Container ) ;
789788 const hostNode = di . node as LContainerNode ;
790789 const hostTNode = hostNode . tNode ;
790+ ngDevMode && assertNodeType ( hostTNode , TNodeType . Container ) ;
791791 ngDevMode && assertDefined ( hostTNode . tViews , 'TView must be allocated' ) ;
792792 di . templateRef = new TemplateRef < any > (
793793 hostNode . view , getOrCreateElementRef ( di ) , hostTNode . tViews as TView , getRenderer ( ) ,
@@ -845,4 +845,4 @@ class TemplateRef<T> implements viewEngine_TemplateRef<T> {
845845 */
846846export function templateRefExtractor ( lNode : LNodeWithLocalRefs ) {
847847 return getOrCreateTemplateRef ( getOrCreateNodeInjectorForNode ( lNode ) ) ;
848- }
848+ }
0 commit comments