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

Function createComponentLView

packages/core/src/render3/view/construction.ts:226–257  ·  view source on GitHub ↗
(
  lView: LView,
  hostTNode: TElementNode,
  def: ComponentDef<T>,
)

Source from the content-addressed store, hash-verified

224}
225
226export function createComponentLView<T>(
227 lView: LView,
228 hostTNode: TElementNode,
229 def: ComponentDef<T>,
230): LView {
231 const native = getNativeByTNode(hostTNode, lView) as RElement;
232 const tView = getOrCreateComponentTView(def);
233
234 // Only component views should be added to the view tree directly. Embedded views are
235 // accessed through their containers because they may be removed / re-added later.
236 const rendererFactory = lView[ENVIRONMENT].rendererFactory;
237 const componentView = addToEndOfViewTree(
238 lView,
239 createLView(
240 lView,
241 tView,
242 null,
243 getInitialLViewFlagsFromDef(def),
244 native,
245 hostTNode as TElementNode,
246 null,
247 rendererFactory.createRenderer(native, def),
248 null,
249 null,
250 null,
251 ),
252 );
253
254 // Component view will always be created before any injected LContainers,
255 // so this is a regular element, wrap it with the component view
256 return (lView[hostTNode.index] = componentView);
257}
258
259/**
260 * Gets the initial set of LView flags based on the component definition that the LView represents.

Callers 1

instantiateAllDirectivesFunction · 0.90

Calls 6

getNativeByTNodeFunction · 0.90
addToEndOfViewTreeFunction · 0.85
createLViewFunction · 0.70
createRendererMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…