fix(ivy): query nodes from different TemplateRefs inserted into one ViewContainerRef (#24254)

PR Close #24254
This commit is contained in:
Pawel Kozlowski
2018-06-01 17:01:24 +02:00
committed by Victor Berchet
parent 5cbcb5680b
commit 0561b66a2b
3 changed files with 126 additions and 6 deletions

View File

@ -706,7 +706,7 @@ export function getOrCreateTemplateRef<T>(di: LInjector): viewEngine_TemplateRef
ngDevMode && assertNotNull(hostTNode.tViews, 'TView must be allocated');
di.templateRef = new TemplateRef<any>(
getOrCreateElementRef(di), hostTNode.tViews as TView, hostNode.data.template !,
getRenderer(), hostNode.queries);
getRenderer(), hostNode.data.queries);
}
return di.templateRef;
}

View File

@ -1514,16 +1514,20 @@ export function container(
// Containers are added to the current view tree instead of their embedded views
// because views can be removed and re-inserted.
addToViewTree(currentView, index, node.data);
const queries = node.queries;
if (queries) {
// prepare place for matching nodes from views inserted into a given container
lContainer.queries = queries.container();
}
createDirectivesAndLocals(localRefs);
isParent = false;
ngDevMode && assertNodeType(previousOrParentNode, TNodeType.Container);
const queries = node.queries;
if (queries) {
// check if a given container node matches
queries.addNode(node);
// prepare place for matching nodes from views inserted into a given container
lContainer.queries = queries.container();
}
}