MCPcopy Index your code
hub / github.com/angular/angular / templateCreate

Function templateCreate

packages/core/src/render3/instructions/template.ts:55–114  ·  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

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…