MCPcopy Create free account
hub / github.com/angular/angular / templateCreate

Function templateCreate

packages/core/src/render3/instructions/template.ts:56–115  ·  view source on GitHub ↗
(
  tNode: TContainerNode,
  declarationLView: LView,
  declarationTView: TView,
  index: number,
  templateFn: ComponentTemplate<any> | null,
  decls: number,
  vars: number,
  flags?: TNodeFlags,
)

Source from the content-addressed store, hash-verified

54} from './shared';
55
56function templateCreate(
57 tNode: TContainerNode,
58 declarationLView: LView,
59 declarationTView: TView,
60 index: number,
61 templateFn: ComponentTemplate<any> | null,
62 decls: number,
63 vars: number,
64 flags?: TNodeFlags,
65) {
66 if (declarationTView.firstCreatePass) {
67 // Merge the template attrs last so that they have the highest priority.
68 tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
69
70 const embeddedTView = (tNode.tView = createTView(
71 TViewType.Embedded,
72 tNode,
73 templateFn,
74 decls,
75 vars,
76 declarationTView.directiveRegistry,
77 declarationTView.pipeRegistry,
78 null,
79 declarationTView.schemas,
80 declarationTView.consts,
81 null /* ssrId */,
82 ));
83
84 if (declarationTView.queries !== null) {
85 declarationTView.queries.template(declarationTView, tNode);
86 embeddedTView.queries = declarationTView.queries.embeddedTView(tNode);
87 }
88 }
89
90 if (flags) {
91 tNode.flags |= flags;
92 }
93 setCurrentTNode(tNode, false);
94
95 const comment = _locateOrCreateContainerAnchor(
96 declarationTView,
97 declarationLView,
98 tNode,
99 index,
100 ) as RComment;
101
102 if (wasLastNodeCreated()) {
103 appendChild(declarationTView, declarationLView, comment, tNode);
104 }
105 attachPatchData(comment, declarationLView);
106
107 const lContainer = createLContainer(comment, declarationLView, comment, tNode);
108 declarationLView[index + HEADER_OFFSET] = lContainer;
109 addToEndOfViewTree(declarationLView, lContainer);
110
111 // If hydration is enabled, looks up dehydrated views in the DOM
112 // using hydration annotation info and stores those views on LContainer.
113 // In client-only mode, this function is a noop.

Callers 2

Calls 11

mergeHostAttrsFunction · 0.90
createTViewFunction · 0.90
setCurrentTNodeFunction · 0.90
wasLastNodeCreatedFunction · 0.90
appendChildFunction · 0.90
attachPatchDataFunction · 0.90
createLContainerFunction · 0.90
addToEndOfViewTreeFunction · 0.90
templateMethod · 0.65
embeddedTViewMethod · 0.65

Tested by

no test coverage detected