fix(ivy): ng-content tags in re-inserted templates should walk declaration tree (#27783)
This PR assures that content projection works if an <ng-content> tag is placed inside an <ng-template> in one component and that <ng-template> is inserted into a different component. It fixes a bug where the projection instruction code would walk up the insertion tree to find selector data instead of the declaration tree. PR Close #27783
This commit is contained in:
@ -21,7 +21,7 @@ import {AttributeMarker, TContainerNode, TElementContainerNode, TElementNode, TN
|
||||
import {DECLARATION_VIEW, HOST_NODE, INJECTOR, LView, TData, TVIEW, TView} from './interfaces/view';
|
||||
import {assertNodeOfPossibleTypes} from './node_assert';
|
||||
import {getLView, getPreviousOrParentTNode, setTNodeAndViewData} from './state';
|
||||
import {getHostTElementNode, getParentInjectorIndex, getParentInjectorView, hasParentInjector, isComponent, isComponentDef, stringify} from './util';
|
||||
import {findComponentView, getParentInjectorIndex, getParentInjectorView, hasParentInjector, isComponent, isComponentDef, stringify} from './util';
|
||||
|
||||
|
||||
/**
|
||||
@ -320,7 +320,8 @@ export function getOrCreateInjectable<T>(
|
||||
let previousTView: TView|null = null;
|
||||
let injectorIndex = getInjectorIndex(tNode, lView);
|
||||
let parentLocation: RelativeInjectorLocation = NO_PARENT_INJECTOR;
|
||||
let hostTElementNode: TNode|null = flags & InjectFlags.Host ? getHostTElementNode(lView) : null;
|
||||
let hostTElementNode: TNode|null =
|
||||
flags & InjectFlags.Host ? findComponentView(lView)[HOST_NODE] : null;
|
||||
|
||||
// If we should skip this injector, or if there is no injector on this node, start by searching
|
||||
// the parent injector.
|
||||
|
Reference in New Issue
Block a user