parent
7014b67e51
commit
565a58e261
|
@ -75,7 +75,7 @@ export function ɵɵtemplate(
|
|||
-1, templateFn, consts, vars, tView.directiveRegistry, tView.pipeRegistry, null, null);
|
||||
}
|
||||
|
||||
createDirectivesAndLocals(tView, lView, localRefs, localRefExtractor);
|
||||
createDirectivesAndLocals(tView, lView, tContainerNode, localRefs, localRefExtractor);
|
||||
addTContainerToQueries(lView, tContainerNode);
|
||||
attachPatchData(getNativeByTNode(tContainerNode, lView), lView);
|
||||
registerPostOrderHooks(tView, tContainerNode);
|
||||
|
|
|
@ -85,7 +85,7 @@ export function ɵɵelementStart(
|
|||
}
|
||||
|
||||
appendChild(native, tNode, lView);
|
||||
createDirectivesAndLocals(tView, lView, localRefs);
|
||||
createDirectivesAndLocals(tView, lView, tNode, localRefs);
|
||||
|
||||
// any immediate children of a component or template container must be pre-emptively
|
||||
// monkey-patched with the component view data so that the element can be inspected
|
||||
|
|
|
@ -59,7 +59,7 @@ export function ɵɵelementContainerStart(
|
|||
}
|
||||
|
||||
appendChild(native, tNode, lView);
|
||||
createDirectivesAndLocals(tView, lView, localRefs);
|
||||
createDirectivesAndLocals(tView, lView, tNode, localRefs);
|
||||
attachPatchData(native, lView);
|
||||
|
||||
const currentQueries = lView[QUERIES];
|
||||
|
|
|
@ -528,19 +528,18 @@ export function executeContentQueries(tView: TView, tNode: TNode, lView: LView)
|
|||
* @param localRefExtractor mapping function that extracts local ref value from TNode
|
||||
*/
|
||||
export function createDirectivesAndLocals(
|
||||
tView: TView, lView: LView, localRefs: string[] | null | undefined,
|
||||
tView: TView, lView: LView, tNode: TElementNode | TContainerNode | TElementContainerNode,
|
||||
localRefs: string[] | null | undefined,
|
||||
localRefExtractor: LocalRefExtractor = getNativeByTNode) {
|
||||
if (!getBindingsEnabled()) return;
|
||||
const previousOrParentTNode = getPreviousOrParentTNode();
|
||||
if (tView.firstTemplatePass) {
|
||||
ngDevMode && ngDevMode.firstTemplatePass++;
|
||||
resolveDirectives(
|
||||
tView, lView, findDirectiveMatches(tView, lView, previousOrParentTNode),
|
||||
previousOrParentTNode, localRefs || null);
|
||||
tView, lView, findDirectiveMatches(tView, lView, tNode), tNode, localRefs || null);
|
||||
}
|
||||
instantiateAllDirectives(tView, lView, previousOrParentTNode);
|
||||
invokeDirectivesHostBindings(tView, lView, previousOrParentTNode);
|
||||
saveResolvedLocalsInData(lView, previousOrParentTNode, localRefExtractor);
|
||||
instantiateAllDirectives(tView, lView, tNode);
|
||||
invokeDirectivesHostBindings(tView, lView, tNode);
|
||||
saveResolvedLocalsInData(lView, tNode, localRefExtractor);
|
||||
setActiveHostElement(null);
|
||||
}
|
||||
|
||||
|
@ -1194,8 +1193,9 @@ function postProcessBaseDirective<T>(
|
|||
* Matches the current node against all available selectors.
|
||||
* If a component is matched (at most one), it is returned in first position in the array.
|
||||
*/
|
||||
function findDirectiveMatches(tView: TView, viewData: LView, tNode: TNode): DirectiveDef<any>[]|
|
||||
null {
|
||||
function findDirectiveMatches(
|
||||
tView: TView, viewData: LView,
|
||||
tNode: TElementNode | TContainerNode | TElementContainerNode): DirectiveDef<any>[]|null {
|
||||
ngDevMode && assertEqual(tView.firstTemplatePass, true, 'should run on first template pass only');
|
||||
const registry = tView.directiveRegistry;
|
||||
let matches: any[]|null = null;
|
||||
|
@ -1204,11 +1204,7 @@ function findDirectiveMatches(tView: TView, viewData: LView, tNode: TNode): Dire
|
|||
const def = registry[i] as ComponentDef<any>| DirectiveDef<any>;
|
||||
if (isNodeMatchingSelectorList(tNode, def.selectors !, /* isProjectionMode */ false)) {
|
||||
matches || (matches = ngDevMode ? new MatchesArray !() : []);
|
||||
diPublicInInjector(
|
||||
getOrCreateNodeInjectorForNode(
|
||||
getPreviousOrParentTNode() as TElementNode | TContainerNode | TElementContainerNode,
|
||||
viewData),
|
||||
tView, def.type);
|
||||
diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, viewData), tView, def.type);
|
||||
|
||||
if (isComponentDef(def)) {
|
||||
if (tNode.flags & TNodeFlags.isComponent) throwMultipleComponentError(tNode);
|
||||
|
|
Loading…
Reference in New Issue