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

Method create

packages/core/src/render3/component_ref.ts:252–298  ·  view source on GitHub ↗
(
    injector: Injector,
    projectableNodes?: any[][] | undefined,
    rootSelectorOrNode?: any,
    environmentInjector?: NgModuleRef<any> | EnvironmentInjector | undefined,
    directives?: (Type<unknown> | DirectiveWithBindings<unknown>)[],
    componentBindings?: Binding[],
  )

Source from the content-addressed store, hash-verified

250 }
251
252 create(
253 injector: Injector,
254 projectableNodes?: any[][] | undefined,
255 rootSelectorOrNode?: any,
256 environmentInjector?: NgModuleRef<any> | EnvironmentInjector | undefined,
257 directives?: (Type<unknown> | DirectiveWithBindings<unknown>)[],
258 componentBindings?: Binding[],
259 ): AbstractComponentRef<T> {
260 profiler(ProfilerEvent.DynamicComponentStart);
261
262 const prevConsumer = setActiveConsumer(null);
263 try {
264 const cmpDef = this.componentDef;
265 ngDevMode && verifyNotAnOrphanComponent(cmpDef);
266 const rootViewInjector = createRootViewInjector(
267 cmpDef,
268 environmentInjector || this.ngModule,
269 injector,
270 );
271 const environment = createRootLViewEnvironment(rootViewInjector);
272 const tracingService = environment.tracingService;
273
274 if (tracingService && tracingService.componentCreate) {
275 return tracingService.componentCreate(getComponentName(cmpDef), () =>
276 this.createComponentRef(
277 environment,
278 rootViewInjector,
279 projectableNodes,
280 rootSelectorOrNode,
281 directives,
282 componentBindings,
283 ),
284 );
285 } else {
286 return this.createComponentRef(
287 environment,
288 rootViewInjector,
289 projectableNodes,
290 rootSelectorOrNode,
291 directives,
292 componentBindings,
293 );
294 }
295 } finally {
296 setActiveConsumer(prevConsumer);
297 }
298 }
299
300 private createComponentRef(
301 environment: LViewEnvironment,

Callers 3

createComponentMethod · 0.95
bootstrapImplMethod · 0.95
createComponentFunction · 0.95

Calls 8

createComponentRefMethod · 0.95
profilerFunction · 0.90
setActiveConsumerFunction · 0.90
getComponentNameFunction · 0.90
createRootViewInjectorFunction · 0.85
componentCreateMethod · 0.80

Tested by

no test coverage detected