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

Function producer

packages/core/src/render3/instructions/foreign_component.ts:168–194  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

166 const getContext = foreignComponent[GET_CONTEXT];
167
168 const producer = () => {
169 const options = getContext
170 ? {embeddedViewInjector: new ForeignContextInjector(getContext())}
171 : undefined;
172
173 // Instantiate and render the embedded view inside the container, but do not add its elements to
174 // the DOM at the container anchor since the nodes will be projected into a foreign view.
175 const embeddedLView = createAndRenderEmbeddedLView(lView, tNode, null, options);
176 addLViewToLContainer(
177 lContainer,
178 embeddedLView,
179 lContainer.length - CONTAINER_HEADER_OFFSET,
180 /* addToDOM */ false,
181 );
182
183 onDestroy(() => {
184 if (!isDestroyed(embeddedLView)) {
185 const embeddedLViewIndex = lContainer.indexOf(embeddedLView, CONTAINER_HEADER_OFFSET);
186 ngDevMode && assertNotSame(embeddedLViewIndex, -1, 'Embedded view not found in container');
187 removeLViewFromLContainer(lContainer, embeddedLViewIndex - CONTAINER_HEADER_OFFSET);
188 }
189 });
190
191 // Extract and return the root nodes of the created view
192 const embeddedTView = embeddedLView[TVIEW];
193 return collectNativeNodes(embeddedTView, embeddedLView, embeddedTView.firstChild, []);
194 };
195
196 return adapter(producer);
197}

Callers 2

eagerContentAdapterFunction · 0.85
frameworkImportFunction · 0.85

Calls 9

addLViewToLContainerFunction · 0.90
isDestroyedFunction · 0.90
assertNotSameFunction · 0.90
collectNativeNodesFunction · 0.90
getContextFunction · 0.85
indexOfMethod · 0.80
onDestroyFunction · 0.50

Tested by

no test coverage detected