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

Function executeTemplate

packages/core/src/render3/instructions/shared.ts:86–116  ·  view source on GitHub ↗
(
  tView: TView,
  lView: LView<T>,
  templateFn: ComponentTemplate<T>,
  rf: RenderFlags,
  context: T,
)

Source from the content-addressed store, hash-verified

84import {writeToDirectiveInput} from './write_to_directive_input';
85
86export function executeTemplate<T>(
87 tView: TView,
88 lView: LView<T>,
89 templateFn: ComponentTemplate<T>,
90 rf: RenderFlags,
91 context: T,
92) {
93 const prevSelectedIndex = getSelectedIndex();
94 const isUpdatePhase = rf & RenderFlags.Update;
95 try {
96 setSelectedIndex(-1);
97 if (isUpdatePhase && lView.length > HEADER_OFFSET) {
98 // When we're updating, inherently select 0 so we don't
99 // have to generate that instruction for most update blocks.
100 selectIndexInternal(tView, lView, HEADER_OFFSET, !!ngDevMode && isInCheckNoChangesMode());
101 }
102
103 const preHookType = isUpdatePhase
104 ? ProfilerEvent.TemplateUpdateStart
105 : ProfilerEvent.TemplateCreateStart;
106 profiler(preHookType, context as unknown as {}, templateFn);
107 templateFn(rf, context);
108 } finally {
109 setSelectedIndex(prevSelectedIndex);
110
111 const postHookType = isUpdatePhase
112 ? ProfilerEvent.TemplateUpdateEnd
113 : ProfilerEvent.TemplateCreateEnd;
114 profiler(postHookType, context as unknown as {}, templateFn);
115 }
116}
117
118/**
119 * Creates directive instances.

Callers 2

renderViewFunction · 0.90
refreshViewFunction · 0.90

Calls 5

getSelectedIndexFunction · 0.90
setSelectedIndexFunction · 0.90
selectIndexInternalFunction · 0.90
isInCheckNoChangesModeFunction · 0.90
profilerFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…