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

Function producer

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

Source from the content-addressed store, hash-verified

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

Callers 3

eagerContentAdapterFunction · 0.85
fooImportFunction · 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